title: Java EE transactions methods marked as not supported
body: <p>I have a method that transfers data from one database to another and in the process creates new tables in the target database. The method is part of a stateless EJB (Java EE 6, GF 3.1) so the container, by default, starts a distributed transaction when the method is called. </p>
  
  <p>The data transfer process essentially runs as two separate steps 1. read from the source database 2. write to the target database. If the read step fails then I don't want the write step to happen but if the write step fails and the read has been committed already I don't really care - I'll just throw the data away.</p>
  
  <p>Initially I hit the problem that my data sources weren't XADataSource's so the container complained about that. I then converted them to XADataSource's but it still failed because the write process (which is into a MySQL database) contains create table statements which cause an implicit commit and you can't do that in a distributed transaction.</p>
  
  <p>The solution I've finally come to is to mark transfer method as TransactionAttributeType.NOT_SUPPORTED and then place the read and write process into their own methods which are called by the parent transfer method.</p>
  
  <p>My question though is this: do the read and write methods run inside their own transactions or does the NOT_SUPPORTED propagate to them? My guess is that they have an implicit TransactionAttributeType.REQUIRED and so will start their own transaction but I'm not sure and I think it's important they are running inside a transaction.</p>
  
  <p>Is this the best solution to this problem?</p>