One day when I tried to use the Hibernate @Cascade annotation, the syntax was correct, but I had the error of "Type mismatch: cannot convert from CascadeType to CascadeType[]".
It turned out I had a mismatch import. To fix it, remove the line
import javax.persistence.CascadeType;
then add the line
import org.hibernate.annotations.CascadeType;
Reference
JPA & Hibernate annotation common mistake
http://www.mkyong.com/hibernate/cascade-jpa-hibernate-annotation-common-mistake/
Ah, Thanks for that. I oddly enough had the opposite problem but you pointed me in the correct direction. I needed to swap
ReplyDeleteimport org.hibernate.annotations.CascadeType;
for
import javax.persistence.CascadeType;
I am glad my post is helpful for you.
Deletewow thanks sir your post also help me great thank you again and God bless you sir
ReplyDeleteThanks but this worked other way around for me. I had to remove hibernate part and use persistence type of import. Thanks though.
ReplyDeleteIts really works,This had resolved my error Thanks for this sir!!!
ReplyDeleteoh thanks sir its helped for me also
ReplyDeletethanks import javax.persistence.CascadeType; this is working
ReplyDeletethanks import javax.persistence.CascadeType; this is working
ReplyDelete
ReplyDeletethanks import javax.persistence.CascadeType its working with
@OneToMany(mappedBy = "user1",cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true)
@Fetch(value = FetchMode.SUBSELECT)