-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Increment generated id strategy not using correct table name
PostPosted: Tue Nov 24, 2009 9:41 pm 
Newbie

Joined: Mon Nov 02, 2009 12:22 am
Posts: 2
Hello,

Am not sure if this is PEBKAC, or a bug, but when I use the "increment" GenericGenerator strategy as follows:
Code:
@Entity
@Table(name = "myEntity",
catalog = "",
schema = "MYDB")

public class MyEntity implements Serializable {
   @Id
    @Basic(optional = false)
    @GeneratedValue(generator="id_mycolumn")
    @GenericGenerator(name = "id_mycolumn",
    strategy = "increment")
    @Column(name = "mycolumn",
    nullable = false)

//... other fields/columns, constructors, getters and setters

}


I find that when Hibernate attempts to find the maximum value of mycolumn, it generates the SQL:
Code:
SELECT max(mycolumn) from myEntity


which fails as Oracle requires the fully qualified table name, ie it should be
Code:
SELECT max(mycolumn) from MYDB.myEntity


It works fine for normal selects, inserts etc as part of the entitymanager persist/merge etc.

A work around is to leave the schema field blank and prefix the table name with it instead.

Does the PEBKAC or shall I submit a bug report?

I am using Hibernate 3.2.5 and Hibernate Annotations 3.3.1.GA as the JPA provider. Have configured Hibernate to use C3P0 for connection pooling.

DB: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production

JDBC Driver: Oracle JDBC driver, version: 11.2.0.1.0


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.