Version 32

    Spec changes

    JBoss EJB 3.0 RC4 is based on the Public Final Draft of the EJB 3.0 specification.  RC3 was based on the public draft.  A great place to review spec specific changes is the spec itself.  It has an appendix on revision history.

     

    Unexhaustive list of Hibernate Entity Manager changes

    • Warning: if you use @SequenceGenerator, make sure to add allocationSize=1, or the DB sequence will be ignored.

    @SequenceGenerator(name="ID_SEQ", sequenceName = "TBXY_SEQ", allocationSize=1)

     

    Unexhaustive list of JBoss Specific Changes

    • EntityManagers and EntityManagerFactories no longer are stored in JNDI by default.  If you want to obtain a reference to a persistence unit you need to set the jboss.entity.manager.jndi.name or jboss.entity.manager.factory.jndi.name respectively in persistence.xml in the properties element

    • persistence.xml files are now required by the specification

    • The persistence.xml schema has changed in the specification.  See the tutorials or the spec for more details.

    • There is no longer a default datasource.  You must specify this attribute in persistence.xml

    • hbm2ddl is now removed and now longer defaulted

    • There is no default DB dialect specified, Hibernate tries to figure it out.

    • A number of annotations have been tweaked in the spec here and there.  refer to the EJB3 spec for more details.

      • For instance: @Id(generator=GeneratorType) is now two annotations @Id and @GeneratedValue

      • @MessageDriven.activateConfig is now @MessageDriven.activationConfig

    • More EJB3 annotation fixes: Hibernate Annotations Migration Guide

    • The default EJB name now defaults to the spec required unqualified bean class name.  So, if your bean class's name is com.acme.TravelAgentBean then the EJB-NAME would be TravelAgentBean.

    • The default JNDI name for any @Remote or @Local interfaces is no longer the FQN of the interface.  It is now EJBNAME/remote or EJBNAME/local respectively.  I know this is a pain, but a bunch of users were complaining of this and it doesn't bode well for those people that reuse the same interfaces for multiple EJB deployments.

    • If you deploy EJBs within an EAR, then the default JNDI name is the same, except the base name is prepended to the default JNDI name.  For example, if it is foo.ear then the default names would be foo/EJBNAME/remote and foo/EJBNAME/local

    • enterprise archive is a plain .jar - .par and .ejb3 are now deprecated but will still work.

    • persistence units that are deployed in EJB JARs are scoped to that EJB JAR.  Only EJBs deployed within that jar can reference the persistence unit by its name with the @Persistence annotations.  If you want to reference these EJB-JAR scoped persistence units from other EJB-JARs, then you must use the syntax.  For example  @PersistenceContext(unitName="../differentjar.jarMyEntityManager   This syntax is described in more detail in the EJB CORE spec.

    • The MBean name for an EJBContainer is:

      • If deployed in an ear: jboss.j2ee:service=EJB3,ear=earname.ear,jar=jarname.jar,name=EJBNAME

    • @Service MBeans have two JMX ObjectNames associated with them:

      • The EJBContainer's ObjectName, whose value is always the ObjectName of any other EJB container

      • The @Management interfaces ObjectName is either the name put in @Service(objectName="..."), or the EJB Container's ObjectName + ,type=ManagementInterface

    • If you are using ejb-jar.xml files, then you must have the version attribute set to 3.0.  Do not declare the schema references as it may go over the internet to validate the XML doc and fail. We also are not fully up to spec on it as well for a few minor things.  So, if you are using ejb-jar.xml, it must look like this:

       <ejb-jar version="3.0">
       </ejb-jar>
    
    • @ApplicationException behaviour changed. Annotating your SFSB/SLSB no longer helps, you have to annotate the actual exception classes.

    • A getSingleResult() returns a NoResultException instead of a EntityNotFoundException when no results are found.

     

    Persistence changes

    http://www.hibernate.org/371.html

     

     

    PLEASE ADD TO THIS SO THAT OTHERS CAN BENEFIT!