Event 1 « Core « JPA Q&A





1. hibernate event detecter    stackoverflow.com

I have a DB running on Oracle. I use Hibernate for data access. I want to be notified whenever an object is saved in the DB, so that I can do ...

2. NullPointerException at org.hibernate.envers.event.AuditEventListener.generateBidirectionalCollectionChangeWorkUnits(...)    stackoverflow.com

I'm using Envers to audit different fields of my entities. The framework works in general but it seems to have problems with some kinds of entity mapping. All former problems I ...

3. Declaring Hibernate event listeners in a JPA environment    stackoverflow.com

Hy guys, I am working on a project developed in JEE 5 environment. I want to know how I can declare a Hibernate event listener so that I can be informed when ...

4. Getting QT to respond to power-events (sleep/hibernate)    stackoverflow.com

I'm trying to develop software that is intelligent wrt sleep events (cleanly closing network connections, making sure data restart locations are set properly, etc). Are there mechanisms in QT (4.6) ...

5. Hibernate and Event based Interaction    stackoverflow.com


For my persistence framework I am using Hibernate. What I would like to do is the following: Whenever a new row in inserted (or value of a column changed) ...

6. How do I gracefully handle hibernate/sleep modes in a winforms application?    stackoverflow.com

I am writing a windows form application in .net using C#. I am running into a problem that if my program is running when the computer goes into the sleep and/or hibernate ...

7. Hibernate Initialisation Finish Event    stackoverflow.com

I would like to know if there is a method to execute some code when Hibernate Initialisation Database finish ? Thank you for your help, Best regards, Update I will try to be more precise: When ...

8. Hibernate Event Listeners Patterns    stackoverflow.com

For a Java Web Application (Struts / Spring / Hibernate), Hibernate Event Listeners are new feature for Audit logging. When there is need to capture some extra information such as the User ...

9. Using Hibernate/JPA Event Listener to update one entity when other entities are updated    stackoverflow.com

I have three entities in my system - one of which must be updated when fields on the other two are changed:

@Entity
public class Order {
    private String name;
 ...





10. Hibernate/Java EE event/messsaging mechanism    stackoverflow.com

I have two applications. One is a Java thick client Swing GUI for controlling some parameters which are stored in the DB. The other is a Java EE server side application ...

11. hibernate PreUpdate, PreDelete and PrePersit simulation    stackoverflow.com

i'm using hibernate with SESSION, i know that @PreUpdate etc.. doesn't work with session, so i'm using hibernate event to simulate it. But i have some problems, i use saveOrUpdate to persist ...

12. Hibernate hql event listener    stackoverflow.com

i create a lot of hibernate event listeners, to catch all database events like load, persist, update, delete etc. All event will be catched but named queries will not be catched ...

13. How to detect system power events such as suspend, hibernate, etc    stackoverflow.com

I want to make a Linux application that send a message to a remote host when a local system (where the application runs) is going to suspend, hibernate or shutdown. I ...

14. Hibernate event listener java configuration    stackoverflow.com

How can I configure hibernate event listeners "post-insert", "post-delete", "post-load", "post-update" in java configuration? Either thru annotations or using Spring IOC? Also, is there a way to configure for a specific ...

15. How to create Hibernate event listener that requires Hibernate session using annotation?    stackoverflow.com

How can I configure hibernate event listeners "post-insert", "post-delete", "post-load", "post-update" in java configuration? The listeners need to access the Hibernate session in order to modify rows in the database. Either ...

16. Receive event before Windows enters standby or hibernate using Win32 API    stackoverflow.com

I'm working on a small chat application written in C++/Qt. My users are complaining that the connection is not shut down gracefully when they are closing the laptop lid and the ...





17. Hibernate Criteria, Select order according to newest events    stackoverflow.com

I have classes in hibernate like this:

@Entity  
class Order{
  private MyPattern pat;   
  @Id  
  private  int id;  
  @OneToMany(cascade = ...

18. Creating user events on certain actions. What is recommended solution?    stackoverflow.com

This question regards how one can effectively create and persist event domain objects on certain system or user triggered events which themselves may or may not persist changes to the database. Im ...

19. Using hql update query in PreInsert Event Listener in nhibernate 3.0 causes error    stackoverflow.com

I am trying to run a hql update query while inserting a new entity using linq nhibernate. I get;

"null id in DomainModel.Entities.StorageNode entry (don't flush the Session after an exception occurs)"
The preinsert ...

20. using hibernate listener after saveorupdate    stackoverflow.com

in my project, some entities should have a signature property based on their values. For example, after creating an entity and filling its attributes, when entity.saveorupdate() method is called, hibernate event ...

21. What event to use in WPF to update Application after Computer was Resumed after Hibernate or Sleeping?    stackoverflow.com

I have WPF App, that needs to be update some data , after computer was resumed from Hibernate, or Sleep mode. Details. If I keep Application open, and sleep computer (or hibernate) ...

22. Howto retrieve Objects from Hibernate Cache Events    forums.terracotta.org

While you probably could achieve monitoring changes to entities by monitoring the cache, why don't you use the Interceptors & events provided by Hibernate itself ? If you really need to get to values from the cache, I'd recommend going through the EntityRegionAccessStrategy though. Other than that, I guess you'd have to use reflection to get to the AbstractReadWriteEhcacheAccessStrategy$Item.value as of ...

23. Unable to locate HQL query plan in cache; generating (from Event)    coderanch.com

The example he is showing is from the tutorial from the Hibernate website. It's a copy&paste, but that's just my guess. + you get this if you don't wrap it: Exception in thread "main" org.hibernate.HibernateException: createQuery is not valid without active transaction [ December 12, 2006: Message edited by: Henrik Engert ]

25. zk+hibernate+event+paginal bug ?    zkoss.org

Orignial message at: https://sourceforge.net/forum/message.php?msg_id=3939240 By: henrichen When you see something like Session is "closed", it is generally because a "detached" DAO is not "reattached" to the current hibernate session before calling database accessing methods. The method then use the previous "attached" hibernate session that is already closed in previous "request" and thus throw the exception. call session.lock( youDAO, LockMode.NONE); to "reattach" ...

26. Event Listeners and Data Partitioning    forum.hibernate.org

Hi All, I'm 'partitioning' my existing data so that some objects are bound by a 'department'. I've used a PreInsertEventListener and PreUpdateEventListener to intercept writes and add the current 'department' to DepartmentBound objects. I also want to intercept reads so that the 'department' is bound to the Criteria for DepartmentBound objects. It seems that the PreLoadEventListener and other load event listeners ...

27. Is the order of collection events determinable?    forum.hibernate.org

Hello, I need to know if the order of created events for collection, such as PostCollectionUpdateEvent is determinable. Let me draw my scenario: I've got a collection that represents a unidirectional one-to-many relationship, a classic parent/child relationship. I'd would create the parents p1 and p2. And the child c1 and c2. and define the relations p1 -> c1 and p2 -> ...

28. org.hibernate.event.EventListeners.initializeListeners error    forum.hibernate.org

Exception in thread "main" java.lang.ExceptionInInitializerError at test_hibernate.TestClient.createLogin(TestClient.java:125) at test_hibernate.TestClient.main(TestClient.java:34) Caused by: org.hibernate.HibernateException: could not init listeners at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:205) at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1352) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at test_hibernate.InitSessionFactory.(InitSessionFactory.java:29) ... 2 more Caused by: org.hibernate.search.SearchException: Failed to instantiate lucene analyzer ...

29. Event Listeners    forum.hibernate.org

30. Getting user and other context info in hibernate events    forum.hibernate.org

Hello, I need to log some hibernate operations like update, insert and delete. I'd like to use hibernate events to do that. Because I'm using GWT, I don't have a scope associated with the logged user. My application has GWT, Spring and Hibernate. But I need to get the user and his IP to register the log. I thought to create ...

31. trigger database post creation event    forum.hibernate.org

I have an Hibernate application where the DB schema is created through HBM2DDL. Thus I have . I would need to change slightly the schema after it has been created for the first time and the DB is empty, thus I would need to execute some custom SQL code. How can i trigger to the database creation event ...

32. org.hibernate.MappingException: Unknown entity: x.y.z.Event    forum.hibernate.org

org.hibernate.dialect.MySQLDialect ...

33. Getting only required value when we use event.geetOldState()    forum.hibernate.org

Hi All, I am using Hibernate 3 as my persistence framework. Below is the sample hbm file I am using. Code: ...

34. Modified date on record via event listeners?    forum.hibernate.org

I'm trying to set a modified date on records before they're saved. I'm using the session interface currently, so I can't use @PrePersist. I've therefore stuck the logic in a SaveOrUpdateListener. This basically works pretty well, except if someone calls save() or update() on an unmodified bean, the listener changes the mod_date and results in an update statement that otherwise wouldn't ...

35. ClassNotFoundException: org.hibernate.event.EventListeners$2    forum.hibernate.org

Get the following exception when trying to stop weblogic10.3.2 server. I have hibernate 3.3.1 in packed in my application and use weblogic-application.xml to put antlr at a higher presedence.

36. Saving another object in post-insert event listener    forum.hibernate.org

Hi, I am trying to insert a row in the audit table when an object of table T is being created. I create a PostInsert Event listener and try to do the auditing in the onPostInsert() method. I am see the onPostInsert() method being triggered when the new object of table T is committed. However, when I flush my new object ...

38. ERROR org.hibernate.event.def.AbstractFlushingEventListener    forum.hibernate.org

Hello .. we recently migrated from Oracle 10g to Oracle 11g. We are using hibernate version 3.1. We started getting random occureneces of the below error and other than the fact the version of the database has changed everything else is excatly the same. Any help will be appreciated 18075480 [[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR org.hibernate.event.def.AbstractFlushingEventListener - Could ...

39. onFlushDirty event has one more property    forum.hibernate.org

Hello, in the onFlushDirty event, in the propertyNames parameter I find a property that it's not mapped in my entity: is a ManyToOne referenced with referencedColumnName, and it has the full entity name (with namespace) in it. Example: Entity A: Other properties here... Entity B: @ManyToOne @JoinColumn(name = "B_COLUMN", referencedColumnName="A_OTHER_COLUMN") A a; While onFlushDirty on A is called, I found something ...

40. error java.lang.NoSuchMethodError: org.hibernate.event.PreIn    forum.hibernate.org

Hello everybody! I am having problems trying to register on my system ... this error appears: Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: org.hibernate.event.PreInsertEvent.getSource()Lorg/hibernate/engine/SessionImplementor; at org.hibernate.validator.event.ValidateEventListener.onPreInsert(ValidateEventListener.java:172) at org.hibernate.action.EntityInsertAction.preInsert(EntityInsertAction.java:178) at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:72) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137) at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54) I have no idea of what can be ... I searched the forums but here ...

41. Accessing session factory in event listener    forum.hibernate.org

42. Event Initializable interface in hibernate 4.0.0.CR7    forum.hibernate.org

We need to create a customer event listener. In this listener, we need to get some customer setting properties from persistent.xml. In hibernate 3.x.x, there is a interface org.hibernate.event.Initializable which allow us to get hold of the hibernate cfg object which we can get those values from persistent.xml. Ever since we upgrade the hibernate from 3.6.8 to 4.0.0.RC7, this interface is ...

43. Event Model    forum.hibernate.org

I'm building my first significant application with Spring & Hibernate and am trying to figure out how to generate application events as objects are persisted. My application is centered around a project. A project has many properties and associated objects. The user manipulates a project through a web interface where they can assign new team members to a project, create new ...

44. Hooks on caching events ?    forum.hibernate.org

Hi, When I navigate through my persistent objects, usually most are already in cache. When I am requesting one that is not in cache, I would like to be notified and be able to define the HQL query responsible to retrieve the requested object and others to prefetch. The background is that I am using huge timeseries tables (multi Gb), I ...

45. Is it possible to catch the DELETE-Event of hibernate    forum.hibernate.org

Hallo, is there any possibility to catch the DELETE-Event of hibernate? My problem is the follwing: i have some reference counters in the objects, which are counting the refernces pointing to this object. If I now delete an object, i have to decrease some of these counters. If i could catch the Delete-Event i could decrease the counters automatically. Tanks for ...

46. Event listner on JMX    forum.hibernate.org

47. Event handling: lastModification tracing    forum.hibernate.org

public class MySaveOrUpdateEventListener extends DefaultSaveOrUpdateEventListener { public Serializable onSaveOrUpdate(SaveOrUpdateEvent event) { if (event.getObject() instanceof IAuditedObject) { IAuditedObject audObj = (IAuditedObject)event.getObject(); audObj.setLastModification(new Date()); } ...

48. Event with fine grained control=DB trigger independency    forum.hibernate.org

Hibernate version: 3.05 -- Hi. Currently an event listener is called to all classes mapped in the configuration of my hibernate application. This makes event system powerful to build audit, replication and that kind of general propose codification. Well, but to create events to a specific class of objects, or maybe to move business logic commonly used in database triggers to ...

49. SessionFactoryObjectFactory: InitialContxt no imp. Event Ctx    forum.hibernate.org

I have narrowed down this error to the SessionFactoryObjectFactory.addInstance(String, String, SessionFactory, Properties) method located in the org.hibernate.impl dir. I am not sure where the called is made to getInitialContext(properties) is actual setting ctx to anything. Has anyone else had this issue? I am going to edited that class and check to see if ctx has a value but don't want to ...

50. Events or triggers    forum.hibernate.org

51. Unhandled event loop exception (newbie)    forum.hibernate.org

Am trying to use an Eclipse wizard in a RCP application to create a new record for a persisted entity; the mappings work well and I have verified correct persistence between the POJO and database in unit tests using the code shown below. However, I am trying to put the update action into the performFinish() method of the wizard: public boolean ...

52. session events    forum.hibernate.org

53. Table not found in statement [select max(uid) from EVENTS]    forum.hibernate.org

I am trying to get my first hibernate application running, followed the introduction in hibernate doc, used the hsqldb. but I am getting errors on following statement: session.save(theEvent); Caused by: java.sql.SQLException: Table not found in statement [select max(uid) from EVENTS] at org.hsqldb.jdbc.Util.throwError(Unknown Source) at org.hsqldb.jdbc.jdbcPreparedStatement.(Unknown Source) at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source) at org.hibernate.id.IncrementGenerator.getNext(IncrementGenerator.java:86) ... 10 more any ideas? after I got this error ...

54. Advance onLoad event behavior ..    forum.hibernate.org

Hibernate version: 3.0 I'm writing an application that requires a very granular authorization model. Every attribute as well as entities within the object tree can have authorization constraints assigned to them. The onLoad event will allow me to filter at the necessary level (prior to loading for performance reasons), but in the case of eager loading, it causes the load to ...

55. Events ... Reference Documentation confusing    forum.hibernate.org

public class MyLoadListener extends DefaultLoadEventListener { // this is the single method defined by the LoadEventListener interface public Object onLoad(LoadEvent event, LoadEventListener.LoadType loadType) throws HibernateException { if ( !MySecurity.isAuthorized( event.getEntityClassName(), event.getEntityId() ) ) ...

56. Hibernate Event Listener API Help needed    forum.hibernate.org

I am trying to persist an entity A, which has a many-to-one relationship to entity B which it holds as an instance member. I have defined the relationship in A.hbm.xml with cascade="save-update". However because I am working with a legacy system, I need to alter the state of A, B in the same way for save and update. In fact I ...

57. event system documentation    forum.hibernate.org

Where can I find documentation about the event system. The tutorial has some info about it but it does not describe when all the events occurs and what the contract for the events are. What actions are allowed, what does the return value indicate etc. etc. I want to use an event listener to update a lastChanged field to the current ...

58. Event Listeners and 'Collection was not processed by flush'    forum.hibernate.org

I am using some Hibernate event listeners which all look like this one: Code: public final class IntegrityGuardianPreUpdate implements PreUpdateEventListener { private static final Class validatableObjectClass = ValidatableObject.class; private final DefaultPreUpdateEventListener defaultListener = new DefaultPreUpdateEventListener(); private IntegrityGuardianPreUpdate() { ...

59. Cannot Create Event Object(from Tutorial) in Oracle DB    forum.hibernate.org

Newbie Joined: Thu Sep 29, 2005 9:38 pm Posts: 1 [newbie] I'm trying to follow the Hibernate Documentation and I copied Event Object and its mapping file and all the rest as mentioned in the doc. Only difference being the database. I'm using Oracle Database. Everything compiles fine but when run, it generates this output (among lots of other output, most ...

60. hibernate events    forum.hibernate.org

61. Bug: ClassCastException when using event listeners    forum.hibernate.org

Hello again, @Dennis: I still can't see where a fault should be in my test program except that it reproduces the ClassCastException, as expected. Despite this, I now noticed that the bug I reported has apparently been fixed in revision 1.96 of the file Configuration.java. I will get a new library version and test it this evening. Bjrn

62. What can cause repeated PostInsert events?    forum.hibernate.org

I have code that implements a listener for PostInsert events. When I run it in a web application in Tomcat, my listener gets invoked repeatedly as a result of one session.save(). When I run the code outside of the web app, in a standalone app, the listener is invoked only once, as it should be. I'm trying to figure out where ...

63. Event Listeners and Identities    forum.hibernate.org

Hmm... I do see it under the id property of PostInsertEvent object, but for some reason it is not under entity object (still null). Thanks for your help. Now my next question is can I potentially rollback (veto) the transaction at this point? Basically I want to try an operation at this level once I know what the database generated key ...

64. Event listener stack    forum.hibernate.org

I have a requirement where I need to have multiple event listeners for the same event (PostInsert). Does anybody know if Hibernate 3 has the capability to register multiple event listeners? In hopes that it was already implemented, I tried using the SessionEventListenerConfig class to register two Listeners, but the last one won. Specifically, I am trying to update a search ...

65. Problems with session flushing and extra update events    forum.hibernate.org

I'm a little curious how hibernate manages foreign keys. I'm seeing something very strange in my application. I have a base table for each table in my schema, along with a history table, and a view. I read/write to the view, and that view has triggers on it which write to the history table. What i'm noticing in the history table ...

66. event listener usage    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hi Hibernate version: 3.05 i've just started to use the event listener classes in hibernate3 and am a little confused as to their intended use. what i am trying to achieve is to trigger an additional update to the one being performed by the system. basically - if record type x ...

67. Update One-to-Many/Many-to-Many does not throw update events    forum.hibernate.org

Update One-to-Many/Many-to-Many does not throw update events Hi guys, great job with v3.1! Hibernate rocks! I have a question about One-to-Many/Many-to-Many actions. Here i have class Camera { String model; Collection lenses = new HashSet(); Flash flash; } class Lens { String model; } Either i map lenses as or , when i add a lens to the lenses. And ...

68. PostInsert Event    forum.hibernate.org

I am trying to use the event listeners in Hibernate 3.1 to log insert activity. I have created my own listerner that implements the PostInsertEventListener Interface and mapped it to the "post-insert" and, after this didn't work, to the "post-commit-insert" event type in my hibernate_config file. The problem is that the onPostInsert function of my listener implementation is being called by ...

69. AutoFlush events?    forum.hibernate.org

I have a set of reference data. These classes are mapped as mutable=false. I perform a simple query which is "from Product"; IE getting everything. I then get an error in my application because Hibernate tries to insert some objects that have nulls for non-nullable fields. It does this because it tries to insert them before I am ready to have ...

70. events and exceptions    forum.hibernate.org

In the application I need to built in validation rule framework. The requirement is that: - rule has to be checked when main object is deleted/created/updates; - rule has to be checked when dependent object is deleted/created/updates (depended means in collection); Choices: 1. Lifecycle interface Problem: on Update works in strange why, it isn't fired when 'update' goes to db, don't ...

71. Event Handler Problem in hibernate3.1    forum.hibernate.org

I am using Hibenrate 3.1, in HibernateUtil.java i have the following code in static intializer, HibernateUtil is used for session related work. static { try { // Create the SessionFactory Configuration configuration = new Configuration(); sessionFactory = configuration.configure().buildSessionFactory(); LoadEventListener[] stack = { new AuditLogEventHandler(), new DefaultLoadEventListener() }; configuration.getEventListeners().setLoadEventListeners(stack); } catch (Throwable ex) { ex.printStackTrace(); throw new ExceptionInInitializerError(ex); } } AuditLogEvent is ...

72. pre-update event listener not firing    forum.hibernate.org

OK, I've done a search on the forum, and a few people have had questions about events, but not this one. I am working with Hibernate embedded in JBoss. I have a multipurpose event listener, configured by Code: ...

73. Need Help in Registering event Listeners    forum.hibernate.org

I am having problem with registering event listeners even though i followed exactly as directed in its reference. I have extended the saveAndUpdateListeners and i registered programatically as follows: Configuration configuration = new Configuration(); sessionFactory = configuration.configure().buildSessionFactory(); configuration.getSessionEventListenerConfig().setSaveOrUpdateEventListener(new SaveOrUpdateEventListenerImpl); Now whenever SaveOrUpdate is called, this SaveOrUpdateEventListenerImpl isnt called, only default SaveOrUpdateEventListener is called. Please help me out here, what am i ...

74. Problems in Registering Event Listeners,Can anyone Help??    forum.hibernate.org

I am having problems when i register event listeners programatically, i have extended the SaveorUpdateListener and i register programatically with the following code: Configuration configuration = new Configuration(); sessionFactory = configuration.configure().buildSessionFactory(); configuration.getSessionEventListenerConfig().setSaveOrUpdateEventListener(new SaveOrUpdateEventListenerImpl()); Now when the statement saveOrUpdate is called, only the defualt listeners are called, i fail to fathom what am i missing. Can anyone please help me out here. ...

76. Does 2nd level cache have event mechanism???    forum.hibernate.org

77. event listener, struts and i18n    forum.hibernate.org

78. queries inside events - why it doesn't work?    forum.hibernate.org

This gives exception: aused by: org.hibernate.exception.GenericJDBCException: could not insert: at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2078) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2427) at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:356) at org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:59) at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1473) at org.jboss.tm.TransactionImpl.beforePrepare(TransactionImpl.java:1092) at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:306) ... 63 more Caused by: java.sql.SQLException: Connection handle has been closed and is unusable at org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(WrappedConnection.java:526) at org.jboss.resource.adapter.jdbc.WrappedConnection.checkTransaction(WrappedConnection.java:513) ...

79. hibernate events and collection was not processed by flush()    forum.hibernate.org

Okay, I am so lost on how to fix this one after hours and hours of debugging. I have an entity Chapter which has a collection of Country entities. Country also has a collection of Country entities (ie sub-countries). The exception below is being thrown on the sub-countries collection because in postFlush, isProcessed() returns false. The exception is: org.hibernate.AssertionFailure: collection was ...

80. Use session for inserts or deletes with events    forum.hibernate.org

81. Use hibernate session with events    forum.hibernate.org

82. OnDelete event    forum.hibernate.org

Current session can be obtained if you are using a Session Handler with a threadlocal implemented private static final ThreadLocal threadSession = new ThreadLocal(); public static Session currentSession() { log.debug("Entering method HibernateUtil:currentSession"); Session s = (Session) threadSession.get(); try { if (s == null) { log.debug("Opening new Session for this thread."); if (getInterceptor() != null) { log.debug("Using interceptor: " + getInterceptor().getClass()); s ...

83. PostUpdateEventListener: event.getOldState() returns null    forum.hibernate.org

public void onPostUpdate(PostUpdateEvent event) { logger.fatal("-----------------------------------------------"); logger.fatal("------------id: " + event.getId()); logger.fatal("------------entity: " + event.getEntity()); ...

84. saveOrUpdate event lister not working?    forum.hibernate.org

I've got this code Listener Class **************************************** public class HibernateEventListener implements SaveOrUpdateEventListener { private static final long serialVersionUID = 8991739587379538184L; /** * When a {@link VersionedObject} or a {@link Version} is updated, update * its old versions so they get their end times set appropriately. */ public void onSaveOrUpdate(SaveOrUpdateEvent event) { Object obj = event.getObject(); System.out.println("in listener" + obj.getClass()); if (obj ...

85. AutoFlush and SaveOrUpdate Events    forum.hibernate.org

Hey folks, I am using Hibernate 3.1.3 and have Problems with the AutoFlushEvents. I get unwanted updates on my objects if I re-read them from the database. I defined a PostLoadEventListener that changes the objects directly after reading them from the database. If I do a re-read, the AutoFlushing of Hibernate writes them back into the DB. Actually am I using ...

86. Can Hibernate generate events based on DB updates?    forum.hibernate.org

I've looked through the documentation and i'm struggling to get a clear handle on this. I've got an app that is supposed to monitor a db table. Whn another app inserts a row into that table, my app reads the data, processes it, and pushes it out to a third party. I could write a manual process, where I poll the ...

87. onPreInsert(PreInsertEvent event) question    forum.hibernate.org

88. Flush within a flush via post-insert event?    forum.hibernate.org

If anyone can shed some light on this, it would be greatly appreciated. Does anyone know how hibernate behaves when session.flush is called within a session.flush? We are currently using the post-insert event which in turn ends up calling a flush. For instance, the scenario is this: 1. Create an aggregate of entities 2. Call session.save 3. Call session.flush 4. An ...

89. Thread issue with Sessions and Event Dispatch Thread    forum.hibernate.org

Hi, I'm writing a Swing gui. We have a search screen that runs a query in hibernate. The search is paginated and we use a SwingWorker. The first chunk of data comes in and we give it to the gui to display. This involves a jump onto the Event Dispatch Thread (EDT). The gui may require associations to be lazy loaded. ...

90. EhCache Event Listeners    forum.hibernate.org

Hi all, I am using EhCache 1.2 with Hibernate 3.1. When an Object is persisted, the Object is also getting added to the Second Level Cache. Can any one tell how it is internally working? Why I am asking this is, after adding an Object to the Second Level Cache, I wants to Index that Object. I'm thinking using the CacheEventListener's, ...

91. Hibernate in event driven environment    forum.hibernate.org

Hi, Currently I'm investigating wether Hibernate would fit in our architecture, which is event driven. One of the requirements is that we want to be able to use lazy loading. Let's say one process fetches object Parent which has a (lazy-loaded) relationship with Child. The process publishes an event with the Parent object on the event router and by doing so ...

92. Events vs UserTypes for encoding values    forum.hibernate.org

I have a situation which warrants a UserType, but I need access to owner on nullSafeGet- which isn't instantiated. I could get round this with a postLoad event, but I'd like to use pure events.... Event Questions ========== Will changing an entity at the late stage of postLoad event trigger a dirty read or disturb anything else? On saving, am I ...

94. Hibernate Event Listeners - Saving Objects    forum.hibernate.org

I try to code : public boolean onPreUpdate(PreUpdateEvent event) { System.out.println("onPreUpdate"); try { if (event.getEntity() instanceof PersistentObjectImpl) { PersistentObjectImpl po = (PersistentObjectImpl) event.getEntity(); if (po.getId() != null) { ClassMetadata metaData = event.getPersister().getFactory().getClassMetadata(po.getClass()); String[] properties = metaData.getPropertyNames(); Object[] oldValues = event.getOldState(); Object[] newValues = metaData.getPropertyValues(event.getEntity(),EntityMode.POJO); Session s = event.getPersister().getFactory().openSession(event.getSource().connection()); //Object copy = s.load(po.getClass(),po.getId()); PersistentObjectImpl ancestor = (PersistentObjectImpl) EcaBusinessObject.createBusinessObject(po.getClass(), oldValues, properties); //ancestor.addSuccesseur((PersistentObjectImpl) copy); ...

95. Auditing with Events    forum.hibernate.org

Hibernate version: 3.2 RC2 Name and version of the database you are using: DB2 UDB 8.3 I tried to figure out how to implement auditing with Hibernate's event system. The goal is to insert an entry with who/when/what changed for every successful insert/update/delete on certain tables. The solutions proposed so far in this forum use Interceptors. My problem is that I ...

96. Criteria query doesn't fire events    forum.hibernate.org

Hi, we're currently considering moving our web-application's persistence layer on Hibernate. However, I did notice one bug(?) in the implementation of Criteria queries. Now I know this feature is currently experimental, but it would provide massive functionality benefits for the end users so I would gladly see it working. The problem is that the Criteria.list() doesn't seem to call the event ...

97. GUI Application: CGLIB Event property missing    forum.hibernate.org

Hi everybody, first I'll describe the scenario: I have two POJOs A and B (A extends B). B has some methods to set a PropertyChangeListener. When this method is called it creates, if not existing, a new private object changeSupport which holds the listeners. Code: public final synchronized void addPropertyChangeListener( ...

98. Hibernate Event and underlying sql statement    forum.hibernate.org

Basically, i need to find out whether there is real database sql statement executed when i do a save/update. I tried to use pre-update event listener, but this interface is called upon session.update(), even no real sql statement is issued to the database. So the question is, in hibernate how to find out whether there are sql statments are send over ...

99. Problems with Event/Person Example Hibernate 3.2    forum.hibernate.org

hi! I'm having awful problems getting the Hibernate 3.2 example (bundled with Hibernate 3.2) Event / Person working... I've got it working with mysql connecting to localhost.. but i can't for the life of me get it working using a hsqldb or derby database.. it successfully inserts the row into the database, but the database is never created... calling the example ...

100. Can I edit the Entity before updating the DB using EVENT?    forum.hibernate.org

public void onPostUpdate(PostUpdateEvent event) { if(event.getEntity() instanceof Client) { Client client = (Client) event.getEntity(); client.setName("Mike"); // <---- ...