zwwcn

Just another WordPress.com site

Cascade JPA Hibernate

E.g:


@OneToMany(mappedBy="invoice",fetch=FetchType.LAZY,cascade={CascadeType.ALL})
@OrderBy("lineNumber")
@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
public List<CodeEntry> entries;

If you are using it with Hibernate, you’ll have to explicitly define org.hibernate.annotations.CascadeType.DELETE_ORPHAN, which can be used in conjunction with JPA CascadeType.ALL.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: