[JBoss-user] [Persistence & CMP/JBoss] - Re: TransactionRolledbackLocalException while creating bean

2004-11-18 Thread redBeard15
I tried wrapping the 'addchild()' method with a 'RequiresNew' transaction 
attribute -- no avail.

Here's what I did to resolve this issue:

1) I created a 'UNIQUE INDEX (entityId, parentKey)' in the (child) entity bean. 
 This will 
prohibit bad data being slammed into the table underneath the beans.

2) In my child bean, I added the following finder query (using Xdoclet tag)

  |  * @ejb.finder
  |  * signature="java.util.Collection findDuplicate (java.lang.String 
iId, java.lang.Integer pKey)"
  |  * query="SELECT OBJECT(a) FROM Item AS a WHERE (a.itemId = ?1) AND 
(a.product.productKey = ?2)"
  |  * view-type="local"
  | 
3) In my parent (Product) bean addChild() method, I just call this 
'findDuplicate()' method
to determine if a duplicate exists.  If so, I throw an exception, else, I 
continue adding the
child.

Seems to work pretty well.

RB

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3855645#3855645

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3855645


---
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence & CMP/JBoss] - Re: TransactionRolledbackLocalException while creating bean

2004-11-15 Thread redBeard15
loubyansky,

Thanks for the message.  I tried adding the following code to my 'ejb-jar.xml' 
file:


  |
  |   
  |  Product
  |  Local
  |  addChild
  |  
  | 
com.tm.wineStore.ejb.catalog.ItemValue
  |  
  |   
  |   RequiresNew
  |
  | 

(Actually, I'm using Xdoclet so I added a '@ejb.transaction type="RequiresNew" 
to the
'addChild()' method.)

The result?  The same as before.  I added a 'catch (Exception E) { 
log.debug(...); }'
around the ItemLocalHome.create() code, but this bit of exception code was 
never tickled.  The
'addChild()' method completed successfully, but some milliseconds later the
JBoss log file contained the same traceback as before..  H.

Any more help?  Thanks, RB

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3855271#3855271

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3855271


---
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user


[JBoss-user] [Persistence & CMP/JBoss] - Re: TransactionRolledbackLocalException while creating bean

2004-11-11 Thread loubyansky
You can addChild in RequiresNew, catch TransactionRollbackException and 
assuming it's unique key violation handle it appropriately.

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3854734#3854734

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3854734


---
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
___
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user