derby 10.6.1.0 native sequence support broken

Description

see also: https://forum.hibernate.org/viewtopic.php?f=1&t=1005637&view=previous

Derby 10.6.1 officially supports sequences. (See JIRA-Task: https://issues.apache.org/jira/browse/DERBY-712, Docs: https://issues.apache.org/jira/browse/DERBY-4568).

usage (e.g. @Id @GeneratedValue(strategy=GenerationType.SEQUENCE) ) produces:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not get next sequence value; nested exception is org.hibernate.exception.SQLGrammarException: could not get next sequence value
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:487)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:430)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

fix is:

org.hibernate.dialect.DerbyDialect needs to override getSequenceNextValString as follows

@Override
public String getSequenceNextValString(String sequenceName) {
return "values next value for " + sequenceName;
}

Environment

apache derby, hibernate 3.5.x/3.6

Activity

Show:
Steve Ebersole
August 26, 2010, 8:52 PM

Not a bug

Max Giesbert
November 2, 2010, 8:46 PM

Thx for fixing this. 3.6.0 final has the fix included. Short question though: Now that Sequence support is added GenerationType.AUTO seems to choose Sequence. This breaks my database as I can not add any new entities (See http://opensource.atlassian.com/projects/hibernate/browse/HHH-5429 ). Any idea on the subject?

Fixed

Assignee

Steve Ebersole

Reporter

Max Giesbert

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor