I'm sure this is a simple beginner error, but I've been pouring over both the JBoss and Hibernate docs and wikis and and am not finding the key missing points.
I'm using JBoss 4.2.2.GA with it's included hibernate3. I'm attempting to build EJB3 standard Entities. I have several classes that are annotated with the javax.persistence.Entity anotation (@Entity) as well as the associated @Column, @Id, etc. All of the annotations I use are from the javax.persistence package (i.e. I'm not using any hibernate or JBoss specific ones). My classes are built into a jar with an associated persistence.xml file which maps to my Datasource (a PostgreSQL one) and sets the hibernate.hbm2ddl.auto property to create. This jar fle is then bundled together with another MDB bean in an ear and deployed.
It all deploys fine and associated table are created. However, it appears that my Annotations are ignored! It seems that hibernate is reflecting upon the classes in question and building it's own view of them for persistance purposes. Specifically, the @Column name and length attributes are NOT as coded in my @Column annotations - they are based upon the actual class attribute name and what must be default lengths. Additionally, the @Enumerated (EnumType.STRING) annotation is similiarly ignored as the created DB tables have integer types.
I've been looking at many different version of documentation as EJB3 support within both hibernae and JBoss have evolved. Yet, I'm fundamentaly missing something. Hence I'm starting to question my understanding.
Is there some configuration that must be done to cause hibernate to honor the Annotations in preference to it's reflect and/or to disable it's reflection? Is it sufficient to have just EJB3 annotated classes with a persistence.xml file or are other configurations and/or files still required in and EJB3 environment - the book I've been working from, 'EJB3 In Action', seems to indicate that this is all it takes.
Are the hbm.xml and/or hibernate config files still required? If so, can they be built from the Anotations? How? It seems that a HAR based deployment once was preferable, but perhaps no longer is? I've additonally added a hibernate-service.xml service module in the ear's jboss-app that refernces the org.jboss.hibernate.jmx.Hibernate mbean. This made no difference in the ignored annotations behavior? Is this approach still needed/relavant?
Any and all guidence to a bewildered EJB3 beginner will be greatly apreciated!