facebook

EJB 3 persistence.xml

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #271811 Reply

    maximuszen
    Member

    I know the basics of writing an entity bean. I’ve also used the reverse engineering ejb 3 feature to create the classes from the database table?

    Why is there a table.java and tableId.java file? tableId.java file has all the fields. Its confusing. Is table.java the primary key class?

    How do I code the persistence.xml file? Can you give me a sample or point me to a good resource?

    #271836 Reply

    Riyad Kalla
    Member

    When you don’t have a primary key setup for a table, or you have a composit key (consisting of 2 or more fields) then an object representing those fields is generated. In the case that you have no primary key set, one is generated for you that automatically uses *every field* of the table… this is because in order to use mapping technology like Hibernate, JPA or EJB3 entities you have to have a PK reference for every record in a table, otherwise there is no way for the persistence engine to differentiate the records from eachother.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: EJB 3 persistence.xml

You must be logged in to post in the forum log in