We are having a problem with EntityBeans and I think it is a generalized problem and wondered how others are solving it.
With EntityBeans, you can invoke a Finder method to find a particular entity (or collection of them). You can also invoke a create method to create a new entity with the specified Key. However, How do you create a new EntityBean when you supply a set of data and the persistent store creates the key for you?
Our situation: We are wrapping a host system function to create a BusinessEntity. The host system takes a small set of data and creates the Entity, including the key identifying the Entity. We have not found a way to do this using EntityBeans. We can do this create via a SessionBean, but whenever we try to put it on the EntityBean, we run into problems with the ejbLoad being invoke (which doesn't make sense because we are not loading it).
Any thoughts/comments would be helpful.
Thanks,
Mike
-
Creating EntityBean without a Key (2 messages)
- Posted by: Mike Mangelson
- Posted on: March 05 2001 19:43 EST
Threaded Messages (2)
- Creating EntityBean without a Key by Nathan Bronson on March 06 2001 00:02 EST
- Creating EntityBean without a Key by Nathan Bronson on March 06 2001 00:03 EST
-
Creating EntityBean without a Key[ Go to top ]
- Posted by: Nathan Bronson
- Posted on: March 06 2001 00:02 EST
- in response to Mike Mangelson
Two possibilities come to mind:
- You could use BMP, in which case the primary key value is returned from ejbCreate and need not be known before the database was accessed.
- You could use a stateless session bean to get a transaction context in which to call your persistant store's create routine, then, in the same transaction context do a normal findByPrimaryKey to locate the entity bean.
-
Creating EntityBean without a Key[ Go to top ]
- Posted by: Nathan Bronson
- Posted on: March 06 2001 00:03 EST
- in response to Mike Mangelson
Two possibilities come to mind:
- You could use BMP, in which case the primary key value is returned from ejbCreate and need not be known before the database was accessed.
- You could use a stateless session bean to get a transaction context in which to call your persistant store's create routine, then, in the same transaction context do a normal findByPrimaryKey to locate the entity bean.