[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1651) hibernate does not find an existing sequence from an Oracle database

Nick Stolwijk (JIRA) noreply at atlassian.com
Fri Nov 3 11:26:06 EST 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1651?page=comments#action_25129 ] 

Nick Stolwijk commented on HHH-1651:
------------------------------------

We have the same problem here. We are not working with annotations but with hbm files and Spring configuration. We have found a workaround by disabling hbm2ddl validation.

> hibernate does not find an existing sequence from an Oracle database
> --------------------------------------------------------------------
>
>          Key: HHH-1651
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1651
>      Project: Hibernate3
>         Type: Bug

>   Components: core
>     Versions: 3.2.0 cr1
>  Environment: Oracle 9i on Linux, Windows 2000, Hibernate-3.2, Hibernate-Annotations-3.1beta9
>     Reporter: Olaf Bigalk
>     Priority: Trivial

>
> Original Estimate: 2 hours
>         Remaining: 2 hours
>
> I have setup a hibernate project with a few classes using id generation by the @Id @Generated annotation.
> The schema update fails due to the following error:
> ...
> 07.04.2006 15:12:07 org.hibernate.tool.hbm2ddl.DatabaseMetadata getTableMetadata
> INFO: table not found: schema.hibernate_sequence
> 07.04.2006 15:12:07 org.hibernate.tool.hbm2ddl.DatabaseMetadata getTableMetadata
> INFO: table not found: hibernate_sequence
> 07.04.2006 15:12:08 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
> SCHWERWIEGEND: Unsuccessful: create sequence schema.hibernate_sequence
> 07.04.2006 15:12:08 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
> SCHWERWIEGEND: ORA-00955: name is already used by an existing object
> ...
> The error ocures because hibernate searches for existing sequences by the full qualified sequence name (i.e. "schema.hibernate_sequence") but it has retrieved the existing sequences from the database metadata with its unqualified names (i.e. "hibernate_sequence") . Hence it doess not find the existing sequence.
> Then it tries to create the pretended non existing sequence and fails.
> The relevant code ist found in org.hibernate.tool.hbm2ddl.DatabaseMetadata
> 	public boolean isSequence(Object key) {
> 		return key instanceof String && sequences.contains( ( (String) key ).toLowerCase() );
> 	}
> It should be somthing like this:
> 	public boolean isSequence(Object key) {
> 		if (key instanceof String) {
> 			String keyString = (String) key;
> 			
> 			if (sequences.contains( keyString.toLowerCase() )  {
> 				return true;
> 			}
> 			String [] strings = StringHelper.split(".", keyString);
> 			if(strings.length==3) {
> 				return sequences.contains( strings[2].toLowerCase();
> 			} else if (strings.length==2) {
> 				return sequences.contains( strings[1].toLowerCase();
> 			}
> 	}

-- 
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
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list