openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco de Booij <>
Subject Postgres sequence: current transaction is aborted
Date Sun, 17 Jun 2012 15:17:38 GMT

I have been searching on the internet for a solution of 'my' problem:
ERROR: current transaction is aborted, commands ignored until end of 
transaction block {prepstmnt 253501751 SELECT 
NEXTVAL('DOOS.SEQ_I18N_CODES')} [code=0, state=25P02]

I found questions on this dating back to 2000 but not clear answer (to 
me) on how to solve it.

What do I have? A class to persist:
@Table(name="I18N_CODES", schema="DOOS")
@SequenceGenerator(name="SEQ_CODE_ID", schema="DOOS", 
public class I18nCodeDto extends Dto
     implements Comparable<I18nCodeDto>, Cloneable {
   @Column(name="CODE_ID", nullable=false)
   private Long codeId;
   @Column(name="CODE", length=100, nullable=false, unique=true)
   private String  code;

   @OrderBy("id.taalKode ASC")
   private List<I18nCodeTekstDto>  teksten = new 

The class has the getters and setters that are needed. The user that 
connects to the datasource has access to the sequence and the tables. I 
get the error when I try to persist the object.

The insert ends up in a create method:
    * Persist de DTO
    * @param dto
    * @return
    * @throws DoosRuntimeException
    * @throws DuplicateObjectException
   public T create(T dto) throws DoosRuntimeException, 
DuplicateObjectException {
     if (getEntityManager().contains(dto)) {
         throw new DuplicateObjectException(DoosLayer.PERSISTENCE, dto,
                                            "bestaat reeds");


     return dto;

My question is how I solve this problem?

I tried it with Postgres 8.4 and 9.1 with the jdbc drivers for this 
version and it failed in both cases. The code worked fine when I used 
MySQL with auto-increment (with the correct @GeneratedValue :-) ) and 
with Oracle Sequence + Hibernate it also works.

I use apache-tomee-plus-1.0.0.



View raw message