JBoss 4.0.5 - EJB3 - Entity Beans
** The problem is - the foreign key column is not set on the newInstance Row. thus the
inserted value is NULL.
There is an new instance of a class that is being worked on as follows:
aggregate = // retrieve / find in database - ie: already persisted
| newInstance = new NewInstance();
| newinstance.setValue(aggregate)
| em.persist(newInstance)
newInstance is saved, as a new row, in the RDBMS just fine; however, the aggregate_fk (see
below for table) is set to null - actually I think it is not even in the insert
statement.
NewInstance.get/setValue are defined below:
@OneToOne(cascade=CascadeType.ALL)
| @JoinColumn(name="aggregate_fk", insertable=false, updatable=false,
referencedColumnName="pk")
| public Aggregate getValue() { return aggregate; }
NewInstance Table (Pseudo Notation for sql)
integer pk
| char(10) column1
| integer aggregate_fk -- foreign key reference to aggregate table
Aggregate is actually a lookup table as below
integer pk
| char(15) key
| varchar(64) value
*Note: this table is referenced by many other tables in the system; therefore, it cannot
contain annotations of OneToMany (etc..) to a specific other table.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025431#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...