-->
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.  [ 5 posts ] 
Author Message
 Post subject: Table with schema but using "hibernate.default_schema&q
PostPosted: Tue Dec 13, 2005 10:38 am 
Newbie

Joined: Tue Dec 13, 2005 10:25 am
Posts: 2
Hibernate version:

3.0.0

[Problem]

I'm using Oracle8 and most of my tables are under the schema "A", but one table can only be accessed without schema prefix. In my mapping I'm using the "hibernate.default_schema" property so I don't have to define the schema everywhere. My problem is that with "hibernate.default_schema" I cannot say to Hibernate not to use schemas.

To ilustrate the problem:

Most of my tables are on schema "A", the following query works:
Quote:
select * from A.table0



But one of my tables "tableN" cannot be accessed using schema prefixes:
Quote:
select * from tableN

No schema prefix will make the select work.


I've tryed to make the mapping of "tableN" not use schemas on the generated SQL, but found no luck. I've tried using schema tags in the class and hibernate-mapping tags:

Quote:
<hibernate-mapping package="xxxx" schema="">
<class name="Yyyy" table="tableNl">
......
</class>
</hibernate-mapping>

And
Quote:
<hibernate-mapping package="xxxx" >
<class name="Yyyy" table="tableNl" schema="">
......
</class>
</hibernate-mapping>


Using schema="" Hibernate throws "java.lang.StringIndexOutOfBoundsException: String index out of range: 0" since it checks for quoting.

Looking at the code seens like Hibernate will allways generate a schema if the default schema is not null.

Do you have some pointers of how I fix this, but without resorting to have to define my schema in every mapping file.

Thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 11:18 am 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
While I haven't used Hibernate w/ Oracle, you should be able omit the "hibernate.default_schema" property and then specify the default schema on the JDBC connection. Hibernate will then generate queries of the form "select * from table1" (no schema). Then for your special case table in the other schema, add the "schema=" attribute to the mapping. That will then generate a query in the form of "select * from schema1.table1".

Good luck,
Curtis ...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 3:41 pm 
Newbie

Joined: Tue Dec 13, 2005 10:25 am
Posts: 2
CWitherow wrote:
While I haven't used Hibernate w/ Oracle, you should be able omit the "hibernate.default_schema" property and then specify the default schema on the JDBC connection. Hibernate will then generate queries of the form "select * from table1" (no schema). Then for your special case table in the other schema, add the "schema=" attribute to the mapping. That will then generate a query in the form of "select * from schema1.table1".

Good luck,
Curtis ...


You see, the problem is that the special case must not use any schema since it´s a private view of the user. Either using JDBC's default schema or Hibernate's I cannot specify to not use schema qualification.


Top
 Profile  
 
 Post subject: Re: Table with schema but using "hibernate.default_schema&q
PostPosted: Thu Apr 26, 2012 9:55 am 
Newbie

Joined: Fri Nov 17, 2006 11:32 am
Posts: 13
Did u find a solution to this problem? I need to build all my queries without specifying the schema_name.

_________________
Neuquino
"Keep on trying and get better every day" (Queen)


Top
 Profile  
 
 Post subject: Re: Table with schema but using "hibernate.default_schema&q
PostPosted: Thu Apr 26, 2012 9:59 am 
Newbie

Joined: Fri Nov 17, 2006 11:32 am
Posts: 13
Did u find a solution to this problem? I need to build all my queries without specifying the schema_name.

_________________
Neuquino
"Keep on trying and get better every day" (Queen)


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

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.