I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
posted 16 years ago
thax for ur help! still,after i know that,how i choose the mapping,ie:if 1 ,2,3,4 are four tables,these four have some relations,then i use these 4 tables as ONE cmp or there are some better mappings? what is the key to make a mapping choice?
Typically, each entity bean has an underlying table in a relational database. Sketch down the abstract schema showing all the relationships between different tables. You can have four types of relationships in CMP : one to one, one to many, many to one, many to many. Each of these relationships can be unidirectional or bidirectional. You can start implementing your abstract schema, as an CMP entity bean for each comonent in the diagram and implement relationships between the CMP beans. Then you can implement finder methods using the EJB-QL. You can use JBuilder or some other IDE tool, JB generates code and xml descriptors for you, when you create beans using the EJB designer. You can find more info about tools on "IDE's and other tools" forum. Visit the following links for more details: http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/EJBConcepts4.html#62950 http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/EJBConcepts.html