Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

CMT

 
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
 
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
 
To avoid criticism do nothing, say nothing, be nothing. -Elbert Hubbard. Please critique this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic