-->
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.  [ 2 posts ] 
Author Message
 Post subject: Oracle SYS.USER$
PostPosted: Wed Sep 22, 2004 5:02 am 
Newbie

Joined: Tue Sep 14, 2004 9:57 am
Posts: 7
I tried to map SYS.USER$ table as
<class name="nl.consul.leapfrog.db.users.User" table="USER$" schema="SYS" lazy="true">
<meta attribute="implement-equals">true</meta>
<id name="userName" column="name" unsaved-value="any" type="string" length="30">
<generator class="assigned" />
</id>
<property name="userId" column="user#" type="long" not-null="true" />
<property name="password" type="string" length="30" />
</class>

but got only:

java.lang.ClassCastException
at users.User$$EnhancerByCGLIB$$b682bfe5.getUserName(<generated>)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 22, 2004 5:21 am 
Newbie

Joined: Tue Sep 14, 2004 9:57 am
Posts: 7
Of course, such a variante works:

<class name="nl.consul.leapfrog.db.users.User" table="USER$" schema="SYS" lazy="true">
<meta attribute="implement-equals">true</meta>
<id name="userId" column="user#" unsaved-value="any" type="long">
<generator class="assigned" />
</id>
<property name="userName" column="name" type="string" length="30" not-null="true" />
<property name="password" type="string" length="30" />
</class>

NB: userId and userName exchanged and thus it turned to be not true because actually userName is indexed (yes, strangely enough (maybe I'm wrong and not) a system table doesn't have primary key)

So, now I need to refer to table through name (yeah, it's not a very good idea to refer to user# here because it has no index but if I want? :-) ) and again through property-ref. What actually leave no choice.

I see two problems:
1. Seems Hibernate assume id should be numeric, isn't?
2. Why key-many-to-one cannot have property-ref? Though maybe my theoretical knowledge is not good enough. :-) And it's a flaw to refer from a primary key to a not primary key or even to a not indexed field. ;-) But if a referred table is not large then performance shouldn't be issue, or?


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