-->
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: Hibernate mapping and db views
PostPosted: Fri Jul 06, 2007 2:06 pm 
Newbie

Joined: Thu Jul 05, 2007 8:12 pm
Posts: 3
Hi,

I have mapped my object to a db view by specifying view name as a table name:
<!-- My class -->
<class name="model.MyClass" table="MYCLASS_VIEW">
<id name="id" column="id"></id>
....
<property name="name" column="name"/>

But Hibernate throws an exception:
org.hibernate.HibernateException: Missing table: HOLDING_V

Has anyone encountered that before?
Is there anything different that I have to do for mapping views vs regular tables?

Thank you for your help!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 06, 2007 2:14 pm 
Newbie

Joined: Thu Jul 05, 2007 8:12 pm
Posts: 3
Sorry posted wrong table name in the error message:

should be

org.hibernate.HibernateException: Missing table: MYCLASS_VIEW


Top
 Profile  
 
 Post subject: DB In Use?
PostPosted: Fri Jul 06, 2007 6:27 pm 
Newbie

Joined: Fri Jul 06, 2007 5:39 pm
Posts: 5
What database are you using for it? Wouldn't be Informix would it?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 06, 2007 6:54 pm 
Newbie

Joined: Thu Jul 05, 2007 8:12 pm
Posts: 3
Oracle 10g

I found a solution actually. not sure if thats a bug in hibernate or not...
this is the property that seems to not allow the hibernate treat views as regular tables...
<!-- <property name="hbm2ddl.auto">validate</property> -->

Once I took it out, everything worked.

Any idea why that is the case? could be a bug in hibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 06, 2007 7:01 pm 
Newbie

Joined: Fri Jul 06, 2007 5:39 pm
Posts: 5
I'm afraid I don't know. Glad you found a fix though. It's entirely possible it's something that's a bug. You could look around in the Hibernate JIRA and see if anything turns up. That's how I finally found a workaround for an issue that's been driving me crazy for days.

Based on my (limited) experience with Informix though, it's possible it's something that's driver dependent. The standard ifxjdbc driver makes Java code break when you try to access views because it returns "bad" meta-data. It's also possible it's just a side-effect of Hibernate trying to (sort of) be all-inclusive and do at least some of what everyone wants rather than everything that some want. (I don't mean that in a bad way by the way. I agree with that sentiment for this project.)

(Link off to JIRA):
http://opensource.atlassian.com/project ... board.jspa


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.