-->
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: Table not found when using joined many-to-one
PostPosted: Sat Oct 15, 2005 4:57 am 
Newbie

Joined: Sat Oct 15, 2005 4:41 am
Posts: 1
I'm using Hibernate 3.0.5 and I'm trying to set up a one directional many-to-one association.

The mapping looks like this:
Code:
<class name="NisCode" table="niscode">
      <cache usage="read-write" />
      <id name="code" type="string" column="code"
         unsaved-value="null">
         <generator class="assigned" />
      </id>
      ...
      <join table="niscode_verwsector" fetch="select" optional="true">
         <key column="niscode" unique="true" />
         <many-to-one name="verwerkingsSector"
            column="key_verwsector" not-null="true" />
      </join>
</class>


Code:
2005-10-15 10:23:56,390 DEBUG [net.sf.ehcache.CacheManager] - Attempting to create an existing instance. Existing instance returned.
2005-10-15 10:23:56,390 DEBUG [org.hibernate.cache.CacheFactory] - instantiating cache region: be.vlaanderen.lin.bredero.be.model.code.plaatsBepaling.NisCode usage strategy: read-write
2005-10-15 10:24:18,906 ERROR [org.hibernate.AssertionFailure] - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: table not found
   at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:433)
   at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:214)


I've run a debugger on it and it seems like the JoinedSubclassEntityPersister does not hold a reference to the joined table "key_verwsector" (which definitely exists) in tableNames, so it bunks out in the getTableId() method. I don't know how or when these tableNames get loaded, so I'm a bit stuck.

Note this very similar thread o the JBoss forums:
http://jboss.com/?module=bb&op=viewtopic&p=3898032

Also note that everything else works just fine when I remove the <join> mapping.


Top
 Profile  
 
 Post subject: Re: Table not found when using joined many-to-one
PostPosted: Sat Nov 12, 2005 11:56 am 
Newbie

Joined: Sat Nov 12, 2005 11:08 am
Posts: 1
Location: Edinburgh
Hi,

I'm geeting the same error but only when I try to inherit (using joined-subclass) from a class that contains the join. hbm2ddl happily creates the tables as I would expect them but building a SessionFactory fails.

I have tried this with Hibernate 3.0.X (included in Spring 1.2.5) as well as with 3.1rc2, no difference.

I have isolated the problem and have put a zip file containing the code onto my homepage at http://homepages.inf.ed.ac.uk/avoss/hibtest.zip
Anyone who wants to have a look at this, please modify conf/hibernate.cfg.xml as well as the build.xml file.

Cheers,

Alex


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.