Hi,

First of all, yes I know Apache Ignite not support SQL Transaction. I hope
this is not showstopper of my POC. 
I`m here to find another way.

1. I have function for update sequence table.

private int sequenceManual(String seqName) {
        int seq = 0;
        Query query;
        try {
                query = this.em.createNativeQuery("UPDATE SEQUENCE SET 
SEQ_COUNT =
SEQ_COUNT + " + INCREMENT + " WHERE SEQ_NAME = '" +seqName+"'");
                seq = (Integer) query.executeUpdate();
        } catch (Exception e) {
                LOG.error("An exception was thrown while Update Sequence " + 
seqName, e);
        }
        
        try {
                query = this.em.createNativeQuery("SELECT SEQ_COUNT FROM 
SEQUENCE WHERE
SEQ_NAME = '"+ seqName +"'");
                seq = (int) ((Number) query.getSingleResult()).longValue();
        } catch (Exception e) {
                LOG.error("An exception was thrown while Next Return Sequence " 
+ seqName,
e);
        }
        return seq;
}

with this code, I have an error:
javax.persistence.TransactionRequiredException: Exception Description: No
transaction is currently active


Then, I modified my code with @Transactional Spring.
@Transactional(propagation=Propagation.REQUIRED)
private int sequenceManual(String seqName) {
    . . . .

I have an error:
java.lang.IllegalStateException: Not allowed to create transaction on shared
EntityManager - use Spring transactions or EJB CMT instead

Is there something suggestion to running my Update Sequence SQL?



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to