i have a one to many relationship (unidirectional).
using a session bean facade I try the following:
1. create parent (batch header) entity (PK = batchNo)
Loop
2. create child (batch message) entities (PK = batchNo,SequenceNo)
End Loop
I am confused with a couple of things....
1. when calling the cmr method parent.getMessages(), I get an empty collection - where are my message entities?. They exist in the DB and my deployment descriptor *supposeably* defines a relationship.
(currently, I just call a finder on the child home entity and this works - but its not cmr!!)
2. do I have to "add" each child to the parent?
(eg parent.getMessages().add(child) ?
what does this do?, or better what is the container doing?
3. when I try to "add" I get the following error:
java.sql.SQLException: ORA-00936: missing expression
4. Most examples I have found show how to "get" the collection/related entities but dont show means for managing the relationship (eg updating, creating, removing)
5. I have read somewhere that the container creates a table in the database to manage relationships - is this true? Although my app deploys successfully, there is no "extra" table in the database.
6. In general, I assume
you should just be able to get your parent entity (findByPrimaryKey) and call the get..() method returning a collection, so why the need to "add" the child in the first place.
Can someone please shed some light? and advise what the sql exception could be due to. I am happy with the ejb-jar.xml <relationship> - looks OK to me and pretty simple - so I can only think its my orion-ejb-jar.xml which is wrong.
I'm still confused though....thanks