[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-4262) Cascade operations don't take affect through a @CollectionOfElements
Gail Badner (JIRA)
noreply at atlassian.com
Mon Aug 23 18:12:53 EDT 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4262?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gail Badner resolved HHH-4262.
------------------------------
Assignee: Gail Badner
Resolution: Duplicate
> Cascade operations don't take affect through a @CollectionOfElements
> --------------------------------------------------------------------
>
> Key: HHH-4262
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4262
> Project: Hibernate Core
> Issue Type: Bug
> Components: annotations
> Environment: Hibernate 3.2.5
> Reporter: Chris L
> Assignee: Gail Badner
>
> Consider having three classes. The first is an @Entity called a View, which has a collection of @Embeddable Column objects. Column objects have an @ManyToOne relationship to a @Entity called Filter.
> The three classes have a very straightforward mapping:
> @javax.persistence.Entity()
> @Entity(dynamicUpdate=true)
> @Table(name="PORTFOLIO_VIEW")
> class View {
> ....
> @JoinTable(name="PORTFOLIO_VIEW_COLUMN",joinColumns={@JoinColumn(name="VIEW_ID")})
> @IndexColumn(name="COLUMN_INDEX")
> @Cascade(CascadeType.ALL)
> @LazyCollection(LazyCollectionOption.FALSE)
> @CollectionOfElements
> private List<Column> columns;
> ....
> }
> @Embeddable
> class Column {
> ....
> @ManyToOne(fetch=FetchType.EAGER)
> @Cascade(CascadeType.ALL)
> @JoinColumn(name="FILTER")
> @Target(FilterImpl.class)
> private Filter filter;
> ....
> }
> @javax.persistence.Entity
> @Entity(dynamicUpdate=true)
> @Table(name="FILTER")
> @DiscriminatorColumn(name="CLASS_NAME",length=255)
> abstract class FilterImpl {
> ....
> }
> When I create a new view, with a new column and filter object, I should be able to save the view and have the @Cascade settings on the @CollectionOfElements and the @ManyToOne inside of Column take affect, and save the Filter. Instead, I get a TransientObjectException because the Filter hasn't been saved yet.
> I know I could work around this by either making Column an Entity, or by adding code to save the Filter before saving the View. But it seems to me this is reasonable usage of an Embeddable.
> This issue was originally part of a forum post http://forum.hibernate.org/viewtopic.php?t=987977
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list