So now I'm trying to get at an instance of JDBCTypeMappingMetaData so I can call getSqlTypeForJavaType() and running into a problem. Here's the only path I've been able to find to get me there (in theory) from an EntityContainer:
CMPPersistenceManager man = (CMPPersistenceManager) container.getPersistenceManager();
JDBCStoreManager store = (JDBCStoreManager) man.getPersistenceStore();
JDBCTypeFactory factory = store.getJDBCTypeFactory();
The problem is, the call to getPersistenceManager() returns an instance of org.jboss.resource.connectionmanager.CachedConnectionInterceptor, which doesn't expose getPersistenceStore(). Looking at the code, it looks like it wraps the real PersistenceManager and then hides it away so there's no way to actually access it. At this point, I'm stuck. Can anyone offer any suggestions on how to get at the PersistenceManager, or some other way to get at the functionality of getSqlTypeForJavaType? Thanks.
Based on the deafening silence here, I assume nobody has a good answer for me. :) I ended up defining a single "adaptor" entity bean with a different container configuration that removed the CachedConnectionInterceptor, then got at the type mapping through that. Works great. But this is a lame hack, and I still can't get to other bean-specific attributes (e.g. table name) that is on each bean's respective instance of JDBCStoreManager. I filed on bug on this problem at http://sourceforge.net/tracker/?func=detail&aid=740024&group_id=22866&atid=376685
are you creating an interceptor to do this? if so, the code you have written will work if you put it in the interceptor's create() method and set an instance variable.