This error appears when I save an entity to the database. I've set up the Entity class and the Repository in several ways, but the error remains. I'm using Firebird 2.5.
The table automatically increments the id column by Trigger.
I ask for help, because I do not know how to solve this problem of inserting a record with the bank that is responsible for generating the id.
Log
Informações: 14.09.2017 18:24:19 [http-listener-1(3)] 36108 ERROR (default) java.lang.Object - org.hibernate.dialect.FirebirdDialect does not support identity key generation
Informações: 14.09.2017 18:24:24 [http-listener-1(3)] 41355 ERROR (default) java.lang.Object - Transaction already active
Below is the class Entity
:
@Entity
@Table(name = "SMADISPO")
public class SmadispoEntity {
@Column(name = "ID_SMADISPO", table = "SMADISPO", nullable = false)
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer idSmadispo;
@Column(name = "CODIGO", table = "SMADISPO")
@Basic
private Integer codigo;
@Column(name = "DESCRICAO", table = "SMADISPO", length = 40)
@Basic
private String descricao;
}
And below is the class that is being executed to save the entity to the database.
@Override
@Transactional
public <S extends T> S save(S entity) {
try {
entityManager.getTransaction().begin();
if (!entityManager.contains(entity)) {
entityManager.persist(entity);
} else {
return entityManager.merge(entity);
}
entityManager.getTransaction().commit();
return entity;
} catch (Exception e) {
logger.error(e.getMessage());
return null;
}
}
Below is the table image in the database and the trigger that generates the ID.