From: <leg...@at...> - 2004-09-10 16:48:04
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/browse/HB-1219 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-1219 Summary: Hibernate doesn't respect hibernate.default_schema when using a sequence generator and PostgreSQL Type: Bug Status: Unassigned Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: Hibernate2 Components: core Versions: 2.1.6 Assignee: Reporter: Sandy McArthur Created: Fri, 10 Sep 2004 12:14 PM Updated: Fri, 10 Sep 2004 12:14 PM Environment: Hibernate 2.1.6, PostgreSQL 7.4.1, Java 1.4.2_03 (Mac OS X) Description: When you specify a default_scheme in the hibernate.cfg.xml the sequence generator doesn't respect the default_schema. Instead it uses the sequence in the "public" schema which is what PostgreSQL's schema search defaults to. Here is the generated SQL from when public.items_id_sequence exists: Hibernate: select nextval ('items_id_sequence') Hibernate: insert into beta2.items (name, id) values (?, ?) Note that the first line doens't specify a schema. Here is the generated SQL and following log lines when public.items_id_sequence doesn't exists: Hibernate: select nextval ('items_id_sequence') Sep 10, 2004 12:07:45 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions WARNING: SQL Error: 0, SQLState: 42P01 Sep 10, 2004 12:07:45 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions SEVERE: ERROR: relation "items_id_sequence" does not exist Sep 10, 2004 12:07:45 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions WARNING: SQL Error: 0, SQLState: 42P01 Sep 10, 2004 12:07:45 PM net.sf.hibernate.util.JDBCExceptionReporter logExceptions SEVERE: ERROR: relation "items_id_sequence" does not exist Sep 10, 2004 12:07:45 PM net.sf.hibernate.JDBCException <init> SEVERE: Could not save object org.postgresql.util.PSQLException: ERROR: relation "items_id_sequence" does not exist at org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139) at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:154) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:101) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43) at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:515) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50) at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:231) at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:69) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388) at test.Something.main(Something.java:24) Exception in thread "main" net.sf.hibernate.JDBCException: Could not save object at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:783) at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1388) at test.Something.main(Something.java:24) Caused by: org.postgresql.util.PSQLException: ERROR: relation "items_id_sequence" does not exist at org.postgresql.util.PSQLException.parseServerError(PSQLException.java:139) at org.postgresql.core.QueryExecutor.executeV3(QueryExecutor.java:154) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:101) at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:43) at org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:515) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:50) at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:231) at net.sf.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:69) at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:765) ... 3 more After some debugging I found that the params passed into net.sf.hibernate.id.SequenceGenerator.configure(...) do not contain a property under the "schema" key, which seems to be why SequenceGenerator.generate(..) doesn't know about the schema. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |