Hi,all
I am writing a application to test Transaction Logging, and I want to
store Transaction Logs in a Database(Derby) by following steps
1. Create a JDBC connection Pool and set the
non-transactional-connections attribute to true.
2. Create a JDBC resource name of jdbc/myds that uses the connection
pool and note the JNDI name of the JDBC resource.
3. Create a table named txn_log_table with the schema:
create table txn_log_table(localtid bigint,servername varchar(40),gtrid
char(70) for bit data)
4. Add the db-logging-resource property to the transaction service.
asadmin set
server.transaction-service.property.db-logging-resource="jdbc/myds"
5. To disable file synchronization, use the following asadmin
create-jvm-options command:
asadmin create-jvm-options -Dcom.sun.appserv.transaction.nofdsync
6. Restart the server
7.deloy the application into default server
** all above steps are configed in the glassfish default server
my application use toplink to persist a entity to database
EJB code like this
@Stateless(name="myejb",mappedName="ejb/myejb")
public class MyBeanImpl implements MyBean {
@PersistenceContext(unitName="myunit")
private EntityManager manager;
public void testInsert(String name, String sex) {
MyEntity entity = new MyEntity();
entity.setName(name);
entity.setSex(sex);
manager.persist(entity);
}
}
Client to invoke the ejb.
the result is the entity is correct insert into the database,
but,I go to check the txn_log_table in the database,
the 'txn_log_table' table does not have any data.
I think txn_log_table will record this transaction.
I don't know why?
Could you help me?
Thanks in advance
Wang