[jboss-jira] [JBoss JIRA] Resolved: (EJBTHREE-1200) SecondaryTable and insert/update
Emmanuel Bernard (JIRA)
jira-events at lists.jboss.org
Wed Mar 5 09:37:57 EST 2008
[ http://jira.jboss.com/jira/browse/EJBTHREE-1200?page=all ]
Emmanuel Bernard resolved EJBTHREE-1200.
----------------------------------------
Resolution: Rejected
Use @org.hibernate.annotations.Table.optional=false on your secondary table
This model is kind of broken though.
Use the Hibernate forum next time.
> SecondaryTable and insert/update
> --------------------------------
>
> Key: EJBTHREE-1200
> URL: http://jira.jboss.com/jira/browse/EJBTHREE-1200
> Project: EJB 3.0
> Issue Type: Bug
> Affects Versions: AS 4.2.1.GA
> Environment: Linux, Mysql 5
> Reporter: Mateusz Mrozewski
>
> I have an Entity which is mapped to two tables with @SecondaryTable annotation. The entity has a composite Primary Key. Most of the things work fine. Only the following scenario fails:
> 1) I have a record in a primary table which corresponds to my entity instance.
> 2) I have a record in a secondary table too, but only the PK fields are filled. Other are null.
> 3) I perform the following code:
> MyEntityPk pk = new MyEntityPk();
> pk.setValue1(value1);
> pk.setValue2(value2);
> MyEntity entity = em.find(MyEntity.class, pk);
> entity.setSomeFieldMappedToSecondaryTable(value3);
> I am expecting an update, because I already have a row in secondary table, but the em tries to perform an insert. When I change value of any field of that row in secondary table (besides pk), an update is performed.
> It looks like ejb3 recognizes secondary table rows an non existing if all fields beside PK are null.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list