-->
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.  [ 1 post ] 
Author Message
 Post subject: AbstractCollectionPersister.getTableName(): AssertionFailure
PostPosted: Fri Mar 14, 2008 6:47 am 
Newbie

Joined: Fri Mar 07, 2008 6:01 am
Posts: 7
Location: Brussels, BELGIUM
Hi all,

I am retrieving table names and columns out of the hbm files.

I am almost done but get logged errors for some collections (<set>...</set>). I am sure the hbm files work as they are used in the main application ;o)
Example :
Code:
<class name="BirthPlace" table="BIRTHPLACE">

      ... ...
      <one-to-one name="place" entity-name="BirthPlace_Place" cascade="all" />
      ... ...
   </class>

   <class name="us.Text" entity-name="BirthPlace_Place" table="TEXT_PLACE">
      ... ...
      <set name="translations" table="TV_TEXT_PLACE" cascade="all">
         <key column="TT_ID" not-null="true" />
         <element column="TRANSLATEDVALUE" type="string" not-null="true" />
      </set>
                                        ... ...
   </class>

I get the collection metadata through :
Code:
...
        Map<String, CollectionMetadata> allCollectionsMetaData = this.getSessionFactory().getAllCollectionMetadata();
        if (allCollectionsMetaData != null && !allCollectionsMetaData.isEmpty()) {
            for (CollectionMetadata metadata : allCollectionsMetaData.values()) {               
                tables.putAll(myMethod((AbstractCollectionPersister) metadata));
            }
        }
...

private Map<String, String> myMethod(final AbstractCollectionPersister metadata) {
        Map<String, String> toReturn = new HashMap<String, String>(5);
        toReturn.put([b]metadata.getTableName()[/b], "column1,col2,...");
        return toReturn;
}


When I try metadata.getTableName(), I get a Log4J dump in my console :
Quote:
58391 [main ] 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: not an association
at org.hibernate.persister.collection.AbstractCollectionPersister.getElementPersister(AbstractCollectionPersister.java:1488)
at us.util.HbmParser.myMethod(HbmParser.java:195)
... ... ...

...but I get well the good table name (???)

So, I think this is a bug (wrong error message).

Cheers

PS : yes, I first searched the forum and I post here before entering any JIRA post, as asked :o)


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

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.