-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Pproblem with cascade="all-delete-orphan"
PostPosted: Thu Sep 11, 2003 6:13 am 
Newbie

Joined: Wed Sep 10, 2003 8:56 am
Posts: 3
I have the following problem, I perform a query and present the result
using the AbstractTableModel of Swing. This is inside a
transaction. This results in a NullPointerException with the following
stack trace:

Code:
[java] Exception occurred during event dispatching:
     [java] java.lang.NullPointerException
     [java]    at net.sf.hibernate.impl.SessionImpl.getPersister(SessionImpl.java:2309)
     [java]    at net.sf.hibernate.impl.SessionImpl.isSaved(SessionImpl.java:2346)
     [java]    at net.sf.hibernate.collection.PersistentCollection.identityRemove(PersistentCollection.java:593)
     [java]    at net.sf.hibernate.collection.PersistentCollection.identityRemoveAll(PersistentCollection.java:587)
     [java]    at net.sf.hibernate.collection.List.getOrphans(List.java:44)
     [java]    at net.sf.hibernate.impl.SessionImpl.getOrphans(SessionImpl.java:2874)
     [java]    at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:305)
     [java]    at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:341)
     [java]    at net.sf.hibernate.impl.SessionImpl.preFlushEntities(SessionImpl.java:2285)
     [java]    at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2015)
     [java]    at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2004)
     [java]    at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:57)
     [java]    at tuhh.aea.mapping.OrderHist.actionPerformed(OrderHist.java:87)



The query is over a list defined by
Code:
<list name="orderlines" inverse="true" cascade="all-delete-orphan">

and involves only a select. The thing is, if I change this to
Code:
<list name="orderlines" inverse="true" cascade="all">

everything works fine with th equery.

Does anybody have a clue what is going on based on this information?

Thanks a lot

volker turau


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 11, 2003 7:08 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I've not seen this one before and its in completely new functionality, so it may be a bug. (Actually, an NPE is should probably _always_ be considered a bug.)


Would you please submit a main() method to JIRA, that reproduces this exception, so I can look at it asap.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 16, 2003 9:43 pm 
Newbie

Joined: Wed Aug 27, 2003 9:08 pm
Posts: 5
Following is an error I got when running SchemaExport:

17/09/2003 10:55:43 net.sf.hibernate.util.XMLHelper$ErrorLogger error
SEVERE: Error parsing XML: e:\eclipse\workspace\persist\r1.0\generated\src\com\g
bst\persist\po\UserPOImpl.hbm.xml(72)
org.xml.sax.SAXParseException: Attribute "cascade" with value "all-delete-orphan
" must have a value from the list "none all save-update delete ".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
known Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.validateDTDattribute(Unkno
wn Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrsAndValid
ate(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown
Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Sourc
e)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
own Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.dom4j.io.SAXReader.read(SAXReader.java:339)
at org.dom4j.io.SAXReader.read(SAXReader.java:219)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java:155)
at net.sf.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:285
)


Top
 Profile  
 
 Post subject: Update problem with cascade="all-delete-orphan"
PostPosted: Fri Oct 10, 2003 4:37 am 
Newbie

Joined: Thu Oct 09, 2003 11:07 pm
Posts: 7
I am having a similar problem to the one listed above using hibernate 2.0.3. The main difference being that I am performing an update via session.saveOrUpdate. If I change my mapping to cascade="all" the update succeeds.

Code:
<bag name="categoryList" lazy="true" inverse="true" cascade="all-delete-orphan">


Using step-through debugging, it appears that this call in SessionImpl getOrphans:
Code:
      
CollectionEntry ce = getCollectionEntry(coll); // SessionImpl.java:2873


returns a null ce (the child collection is not found) and thus the next line:

Code:
return ce.isNew() ? EMPTY : coll.getOrphans( ce.getSnapshot() ); // SessionImpl.java:2874


yields the NullPointerException.

here's the relevant stack trace:

Code:
java.lang.NullPointerException
at net.sf.hibernate.impl.SessionImpl.getOrphans(SessionImpl.java:2874)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:305)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:341)
at net.sf.hibernate.impl.SessionImpl.preFlushEntities(SessionImpl.java:2285)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2015)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2004)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:57)
at com.mandaladesigns.apps.commerce.services.hibernate.HibernatePersistenceServiceImpl.update(HibernatePersistenceServiceImpl.java:58)


Any suggestions on next steps?

Thanks,

Jonathan.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.