Version 2

    Verify the EJB 2.1 CMP Mappings are correct in your datasource...


    Most likely you have copied the datasource xml file(-ds.xml) file that corresponds to your particular database.  If you are creating one of your own you will need to check that the mappings in ejb2.1 and the ejb timers correspond to your database.  If you don't have this entry at the bottom of this tip, the application server will throw an exception, even if you don't use ejb2.1.  EJBTimers use the type mappings and they will throw exceptions.


    In each of the -ds.xml files you will find an entry at the bottom that describes the Object to type mappings that are used for EJB2.1 persistence. Keep in mind that EJBtimers are also used. If you omit the following metadata tags from the -ds.xml file you are using, you will most likely have an exception when the EJBTimers start.


    This metadata element that is in the -ds.xml file points to an entry in the standardjbosscmp-jdbc.xml that specifies the type mappings for that particular driver. In EJB2.1 CMP, information had to be kept about what primitives and objects mapped to types of jdbc fields. Hibernate/EJB3 does this by setting the dialect, which is a jdbc driver specific mapping of exceptions and field types. This entry is very similar to a dialect.


    Example metadata mapping that should be in the -ds.xml file. Look for it's matching type mapping for EJB2.1 CMP in standardjbosscmp-jdbc.xml.




    Please note, that Oracle 9i was the last one in the Oracle series, Jboss only changes the type mappings when they change with oracle.  So if you are using 10g, or 11g, you can use the 9i mappings.