I am using hibernate 4.3.8.Final and trying to implement either the PostInsertEventListener or SaveOrUpdateEventListener.
I have implemented a classes which implements these. These implementations simply contain the require method and each method performs a System.out.println.
Here is what I have added to my hibernate.cfg.xml:
Code:
<mapping class="com.hib.entities.DeviceData"></mapping>
<listener class="com.hib.listeners.PostInsertListener" type="post-insert" />
<listener class="com.hib.listeners.SaveUpdateListener" type="save-update" />
</session-factory>
When I run my application, I don't see any of the system.outs.
Here the code that is being used to add rows:
Code:
session.beginTransaction();
DeviceData deviceData = new DeviceData(deviceName, deviceStatus);
session.saveOrUpdate(deviceData);
session.getTransaction().commit();
Could anyone help me out? Have spent several hours with google and have yet to find anything that helps.