I am having a weird problem with a sequence. Im using postgresql 9 with geronimo 2.2. I have created the sequence PLANTS_ID_SEQ
inside the db environment and when I try to create a new entity I get an error in my logs (which comes from postegresql) that the relation PLANTS_ID_SEQ
exists. It seems that it tries to create the sequence that is already created. This is the code from the entity bean:
@Id
@GeneratedValue(generator="PLANTS_SEQ",strategy=GenerationType.SEQUENCE) @SequenceGenerator(name="PLANTS_SEQ", sequenceName="PLANTS_ID_SEQ",allocationSize=1) @Column(name = "ID")
private Integer id;
Please notice that if I change the sequence name (eg sequenceName="MY_SEQ"
)then the code runs correctly but it creates in postgresql (and obviously uses) the MY_SEQ sequence. If anyone has a clue about this case please share.
Thanks George