[jboss-jira] [JBoss JIRA] Resolved: (EJBTHREE-793) OneToMany (parent-child) with composite PK fails when inserting a child.
Emmanuel Bernard (JIRA)
jira-events at lists.jboss.org
Tue Feb 13 22:05:34 EST 2007
[ http://jira.jboss.com/jira/browse/EJBTHREE-793?page=all ]
Emmanuel Bernard resolved EJBTHREE-793.
---------------------------------------
Resolution: Rejected
as per user request
> OneToMany (parent-child) with composite PK fails when inserting a child.
> ------------------------------------------------------------------------
>
> Key: EJBTHREE-793
> URL: http://jira.jboss.com/jira/browse/EJBTHREE-793
> Project: EJB 3.0
> Issue Type: Bug
> Environment: Linux
> Reporter: Gunnar Grim
>
> OneToMany (parent-child) with composite PK on the child side fails when inserting a child. Only the first part of the PK has a value. Before em.persist, both key attributes have values but JBoss attempts to insert null into the second key attribute.
> The application works fine on Sun Java Application Server 9.0 but fails on JBoss 4.0.5-GA.
> The (stripped down) entity beans:
> @Entity
> @Table(name = "RelMain")
> public class RelMain
> implements Serializable
> {
> private Long itsMainID;
> private String itsMainText;
> private Set<RelSub> itsSubs;
> public RelMain(Long pMainID)
> {
> itsMainID = pMainID;
> }
> @Id
> @Column(name = "MainID", nullable = false)
> public Long getMainID()
> {
> return itsMainID;
> }
> public void setMainID(Long pMainID)
> {
> itsMainID = pMainID;
> }
> @Column(name = "MainText")
> public String getMainText()
> {
> return itsMainText;
> }
> public void setMainText(String pMainText)
> {
> itsMainText = pMainText;
> }
> @OneToMany(mappedBy="main", cascade={CascadeType.REMOVE})
> public Set<RelSub> getSubs()
> {
> return itsSubs;
> }
> public void setSubs(Set<RelSub> pSubs)
> {
> itsSubs = pSubs;
> }
> }
> @Entity
> @Table(name = "RelSub")
> public class RelSub
> implements Serializable
> {
> private Long itsMainID;
> private String itsSubNo;
> private int itsSubValue;
> private RelMain itsMain;
>
> public RelSub(Long pMainID, String pSubNo)
> {
> itsMainID = pMainID;
> itsSubNo = pSubNo;
> }
>
> @Id
> @Column(name = "MainID", nullable = false)
> public Long getMainID()
> {
> return itsMainID;
> }
> public void setMainID(Long pMainID)
> {
> itsMainID = pMainID;
> }
> @Id
> @Column(name = "SubNo", nullable = false)
> public String getSubNo()
> {
> return itsSubNo;
> }
> public void setSubNo(String pSubNo)
> {
> itsSubNo = pSubNo;
> }
> @Column(name = "SubValue")
> public int getSubValue()
> {
> return itsSubValue;
> }
> public void setSubValue(int pSubValue)
> {
> itsSubValue = pSubValue;
> }
>
> @ManyToOne
> @JoinColumns({
> @JoinColumn(name="MainID", insertable=false, updatable=false)
> })
> public RelMain getMain()
> {
> return itsMain;
> }
> public void setMain(RelMain pMain)
> {
> itsMain = pMain;
> }
> }
--
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