Hello everyone!
I'm newbie with JTA and JBoss. Forgive me if my question is very stupid. This is my code:
public class Application {
public static String URL = "java:comp/UserTransaction";
public Application() throws IllegalStateException, SecurityException, SystemException {
UserTransaction user = null;
SchemaAdmin schema = new SchemaAdmin();
try
{
Context ic = new InitialContext();
user = (UserTransaction) ic.lookup(URL);
user.begin();
schema.addSchemaReference( "172.25.0.3", "rogerio.schema" );
schema.addSchemaReference( "172.25.0.20", "rogerio.schema" );
schema.addSchemaReference( "172.25.0.19", "rogerio.schema" );
schema.addSchemaReference( "172.25.0.22", "rogerio.schema" );
user.commit();
}catch ( NamingException nex ){
nex.printStackTrace();
}
catch ( Exception sex ){
System.out.println ( "Entrei no rollback" );
user.rollback();
sex.printStackTrace();
}
}
}