I have an EJB 3.0 client and server with JBoss AS 7.1.1. I’m trying to persist a list of entities to the database I’m connected to but I keep getting this error:
java.sql.SQLException: ORA-06576: not a valid function or procedure name
I have a sequence generator called SEQ_ID in my Oracle database. I followed this tutorial in setting it up: http://www.developerscrappad.com/408/java/java-ee/ejb3-jpa-3-ways-of-generating-primary-key-through-generatedvalue/
Here is my entity bean that uses the annotations in the above tutorial on the primary key: http://pastebin.com/QJ6W5VLG
Here is my function that persists the list of entities:
public void persistSchemas(List schemasList){
String strDelete = " DELETE FROM Schemas s ";
Query query = em.createQuery(strDelete);
query.executeUpdate();
for(Schemas schema : (List<Schemas>)schemasList){
em.persist(schema);
}
}
Here is the full stack trace of the error on the server:
http://pastebin.com/rmURYdRD
The error only shows up when I try to persist the entities and they have the two annotations @SequenceGenerator and @GeneratedValue. So it’s definitely something going on with the sequence. What is wrong here?
Turns out that the HQL dialect was wrong. I needed to change it to:
In my persistence.xml in the META-INF folder of my server.