submit a patch in jira that sends it to log.trace (in less than 4 individual lines ;) and we will consider it.
/max > Hi, > > I'm trying to debug/fix Hibernate messages like > "org.hibernate.NonUniqueObjectException: a different object with the > same identifier value was already associated with the session: "... and > I find the default exception logging in > AbstractSaveEventListener#performSave not sufficient. I've added some > System.err.printlns() with the information I typically need. It would be > great if this debug info would make it somehow into the latest SVN. > > Rgds > Holger > > /** > * Ppepares the save call by checking the session caches for a > pre-existing > * entity and performing any lifecycle callbacks. > * @param entity The entity to be saved. > * @param id The id by which to save the entity. > * @param persister The entity's persister instance. > * @param useIdentityColumn Is an identity column in use? > * @param source The session from which the event originated. > * @param requiresImmediateIdAccess does the event context require > * access to the identifier immediately after execution of this method > (if > * not, post-insert style id generators may be postponed if we are > outside > * a transaction). > * @return The id used to save the entity; may be null depending on the > * type of id generator used and the requiresImmediateIdAccess value > * @throws HibernateException > */ > protected Serializable performSave( > Object entity, > Serializable id, > EntityPersister persister, > boolean useIdentityColumn, > Object anything, > EventSource source, > boolean requiresImmediateIdAccess) > throws HibernateException { > > if ( log.isTraceEnabled() ) { > log.trace( > "saving " + > MessageHelper.infoString( persister, > id, source.getFactory() ) > ); > } > > EntityKey key; > if ( !useIdentityColumn ) { > key = new EntityKey( id, persister, > source.getEntityMode() ); > Object old = > source.getPersistenceContext().getEntity(key); > if (old != null) { > if ( > source.getPersistenceContext().getEntry(old).getStatus() == > Status.DELETED ) { > source.forceFlush( > source.getPersistenceContext().getEntry(old) ); > } > else { > System.err.println("old: " + old); > System.err.println("old.class: " + > old.getClass()); > System.err.println("entity: " + entity); > System.err.println("entity.class: " + > entity.getClass()); > System.err.println("id: " + id); > throw new NonUniqueObjectException( id, > persister.getEntityName() ); > } > } > persister.setIdentifier(entity, id, > source.getEntityMode()); > } > else { > key = null; > } > > if ( invokeSaveLifecycle(entity, persister, source) ) { > return id; //EARLY EXIT > } > > return performSaveOrReplicate( > entity, > key, > persister, > useIdentityColumn, > anything, > source, > requiresImmediateIdAccess > ); > } > -- -- Max Rydahl Andersen callto://max.rydahl.andersen Hibernate [EMAIL PROTECTED] http://hibernate.org JBoss Inc [EMAIL PROTECTED] ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ hibernate-devel mailing list hibernate-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/hibernate-devel