hi,
I'm using EJB and i have a question about Entity Bean component. I read that
we can create entity bean without primary key, but one does not explain what
it is necessary to put in the descrpitor ejb-jar.xml, if we must remove or
keep tags referenced a primary key (such <prim-key-class>....)?
Thank you
Salim
-
how to create an entity bean without primary key (7 messages)
- Posted by: Salim Bouzitouna
- Posted on: December 20 2004 16:03 EST
Threaded Messages (7)
- how to create an entity bean without primary key by Martin Straus on December 22 2004 08:35 EST
- how to create an entity bean without primary key by Salim Bouzitouna on December 27 2004 07:47 EST
-
how to create an entity bean without primary key by Martin Straus on December 27 2004 09:07 EST
-
how to create an entity bean without primary key by Salim Bouzitouna on December 27 2004 01:20 EST
-
how to create an entity bean without primary key by Martin Straus on December 28 2004 08:54 EST
-
how to create an entity bean without primary key by Salim Bouzitouna on December 28 2004 12:27 EST
- how to create an entity bean without primary key by Salim Bouzitouna on December 28 2004 01:02 EST
-
how to create an entity bean without primary key by Salim Bouzitouna on December 28 2004 12:27 EST
-
how to create an entity bean without primary key by Martin Straus on December 28 2004 08:54 EST
-
how to create an entity bean without primary key by Salim Bouzitouna on December 27 2004 01:20 EST
-
how to create an entity bean without primary key by Martin Straus on December 27 2004 09:07 EST
- how to create an entity bean without primary key by Salim Bouzitouna on December 27 2004 07:47 EST
-
how to create an entity bean without primary key[ Go to top ]
- Posted by: Martin Straus
- Posted on: December 22 2004 08:35 EST
- in response to Salim Bouzitouna
I read that we can create entity bean without primary key
I'd very much like to read that... entity EJB with no primary key makes no sense to me. That's why we have session EJBs...
Regards,
Martin -
how to create an entity bean without primary key[ Go to top ]
- Posted by: Salim Bouzitouna
- Posted on: December 27 2004 07:47 EST
- in response to Martin Straus
you are right, an entity bean without primary key has not sense for me also. Indeed, I didn’t say all, but what I would like exactly is to merge two EJBs source by creating a new Entity bean and establishing two relationships from this new EJB to them. On other hand, to avoid the redundant stocked data in Database, I want to consider that the primary key of the new Entity bean is a one of the two established relationship.
Thanks by advance if you can help me.
Salim -
how to create an entity bean without primary key[ Go to top ]
- Posted by: Martin Straus
- Posted on: December 27 2004 09:07 EST
- in response to Salim Bouzitouna
You mean you want to avoid GENERATING the primary key? What's re relationship model? Cardinality, navegability and so on? What component is responsible for creating instances of this new EJB?
I might be able to help with this info.
Regards,
Martin -
how to create an entity bean without primary key[ Go to top ]
- Posted by: Salim Bouzitouna
- Posted on: December 27 2004 13:20 EST
- in response to Martin Straus
It is exactly what I wanted. both relationships between the new EJB and the two ejbs source to be merged are one to one with an unidirectionel navigability towards the EJBs source
thank you -
how to create an entity bean without primary key[ Go to top ]
- Posted by: Martin Straus
- Posted on: December 28 2004 08:54 EST
- in response to Salim Bouzitouna
Who's responsible for creating instances of this new EJB? I guess the relationships between the new EJB and the two original ones represent aggregations: "EJB A and EJB B aggregate the new EJB".
If that's the case, no matter who creates instances of the new EJB; it's ejbCreate() method should receive the related instances of the other EJBs and generate its own PK from them. Minor sample:
public class NewEjb implements EntityBean
{
//...
public NewEjbPKey ejbCreate(EjbA a, EjbB b)
throws CreateException
{
setPKey(new NewEjbPKey(a.getPKey(), b.getPKey()));
// store in DB.
return getPKey();
}
//...
}
Hope this represents your semantics...
Regards,
Martin -
how to create an entity bean without primary key[ Go to top ]
- Posted by: Salim Bouzitouna
- Posted on: December 28 2004 12:27 EST
- in response to Martin Straus
On the contrary, it is the new EJB which aggragate the both orignal ones.
It doesn't matter, I think that your propositon answers well my requète. made a thing resembling your proposal, but by using the ejbStore method, but I think that it is more judicious to make it at the creation of EJB like your proposal. I will try it and will keep you informed.
below the scheme of the aggregation
/-> EJBa
New EJB
\-> EJBb
Thanks a lot
regards,
Salim -
how to create an entity bean without primary key[ Go to top ]
- Posted by: Salim Bouzitouna
- Posted on: December 28 2004 13:02 EST
- in response to Salim Bouzitouna
excuse me, I was mistaken, I used ejbPostCreat method and not ejbStrore method as mentioned in my message
regards,
Salim