Hi,
I'm trying to use JBOSS IDE for Eclipse but I'm having trouble using an automatic generated id populated from a Oracle sequence previously created in the database. I guess there is some aditional configuration that I need to do in my application but I don't know what it is.
In the persistence XML I have:
<?xml version="1.0" encoding="UTF-8"?> <persistence> <persistence-unit name="shoestringPU">> <jta-data-source>java:/OracleDS</jta-data-source> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/> </properties> </persistence-unit> </persistence>
@Id @GeneratedValue(strategy=GenerationType.AUTO) public int getId() { return id; }
This is an EJB3 question...
But anyway... Add this to your getId():
@GeneratedValue(strategy = GenerationType.AUTO, generator = "MY_ID_SEQ")
@SequenceGenerator(name = "MY_ID_SEQ", sequenceName = "MY_ID_SEQ")