Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Hibernate 3.0 rc1
I am trying to extend the Hibernate framework to allow me to read and write my own custom version of what essentially is a Map. I used to use the Interceptor just fine with Hibernate3 Beta 1, but it is not working anymore.
I did some digging to find new interfaces, Tupilizer and Instantiator. Can you provide some feedback as to how to use these and where I can plug them into the framework? I have created a Tuplizer and Instantiator for my custom objects, but can't find the place to plug them in. Is there a way to create my own EntityMode?
Code:
Configuration config = new Configuration().configure( new File( hibernateConfigFile ) );
config.setInterceptor( new MetaObjectInterceptor() );
sessionFactory = config.buildSessionFactory();
MetaKit metaKit = new MapMetaKit( null );
MetaObject metaObject = metaKit.getMetaObjectFactory().createMetaObject( metaClass );
metaObject.setProperty( "name", "Engine 611" );
metaObject.setProperty( "unitType", "Engine" );
metaObject.setProperty( "stationNumber", new Integer( 11 ) );
metaObject.setProperty( "gallonsOfWater", new Integer( 750 ) );
metaObject.setProperty( "singleAxle", Boolean.TRUE );
Session session = sessionFactory.openSession();
Session mSession = session.openSession( EntityMode.MAP );
Transaction tx = session.beginTransaction();
mSession.saveOrUpdate( metaObject );
session.flush();
tx.commit();
session.close();