• Post Reply Bookmark Topic Watch Topic
  • New Topic

CMT  RSS feed

 
stephen smithstone
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a customer ejb and customerrole ejb with a m:m relationship
mapped across via a cross-over table
so the idea is that people can only assign a role(s) to a customer that is
in the customer role table , and then i have a session bean that managers the creation of users below


in the above code i want the entire transaction to be rollbacked so that the customer is removed and anything in the roles is removed
in my transaction i have all methods set to required
however everything runs and just throws an error when i try to insert a role that is not in the CustomerRole table please can any one help
i've probably left loads of details out please let me know if it doesnt make sense
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by stephen smithstone:
in the above code i want the entire transaction to be rollbacked so that the customer is removed and anything in the roles is removed
in my transaction i have all methods set to required

Since the methods that createUser() calls [CustomerHome.crelate() and CustomerRole.add()] are transactional, I suspect that a transaction is being created for each method invokation. If you begin a transaction manually in createUser(), then you'll be able to roll it back entirely if creating the user or assigning roles fails.
 
stephen smithstone
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
all sorted now i had the wrong table types in mySQL
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!