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.  [ 4 posts ] 
Author Message
 Post subject: Uppercase TABLE names with backticks doesn't work !
PostPosted: Tue Apr 15, 2008 10:40 am 
Newbie

Joined: Tue Apr 15, 2008 10:29 am
Posts: 3
Hello,

I'm relatively new to hibernate. It looks good but I have a very big problem...

Our database has all the tables names in uppercases,

USER, USERGROUP, etc...

In my hibernate config file I have something like this....

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


<hibernate-mapping auto-import="true" default-lazy="false">

<class name="ro.etc.hibernate.domain.authorisation.Authorisation"
table="`APPUSER_TEST`" schema="ANCPI" >
<id name="appuserid" column="APPUSERID" type="java.lang.Integer" unsaved-value="0">
<generator class="native"/>
</id>
<property name="username" column="USERNAME"/>

<set name="groups" table="`USERXGROUP_TEST`" schema="ANCPI">
<key column="appuserid"/>
<many-to-many column="usergroupid" class="ro.star.ancpi.eTerra1.hibernate.domain.authorisation.Group"/>
</set>

</class>

<class name="ro.etc.hibernate.domain.authorisation.Group"
table="`USERGROUP_TEST`" schema="ANCPI">
<id name="groupid" column="GROUPID">
<generator class="native"/>
</id>
<property name="groupname" column="GROUPNAME"/>
</class>

</hibernate-mapping>


I want hibernate to generate the Oracle Sql using exactly my table names,
APPUSER_TEST, USERGROUP_TEST, etc...in the exact cases.

I used the famous backticks ````````` but with no results. It simply doesn't work !


Can you help me ?


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 15, 2008 12:29 pm 
Newbie

Joined: Tue Apr 15, 2008 5:28 am
Posts: 6
try using
Code:
\"
maybe that will do the trick


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 16, 2008 2:52 am 
Newbie

Joined: Tue Apr 15, 2008 10:29 am
Posts: 3
Thanks for your response Glimmlampe.

I tried the \" approach before but I forgot to mention it.

something like this:
----
table="\"MY_TABLE_NAME\""
----
gives the following error at compile time:

Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream.


Anyway...it seems to me really odd that Hibernate by default transform tables' names from the mapping files to lowercases.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 16, 2008 3:00 am 
Newbie

Joined: Tue Apr 15, 2008 10:29 am
Posts: 3
Also tried

table='"MY_TABLE_NAME"' <-- if it's not direct readable it's

<simple quote><double quote>MY_TABLE_NAME<simple quote><double quote>

and when my HQL was transformed to SQL the query was:

...from "my_table_name"..........

also tried escape characters " &quot; for double quote...

""MY_TABLE_NAME"" and "&quot;MY_TABLE_NAME&quot;"

in this cases the sql was :
...from ?my_table_name?..........

Is this a bug ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.