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)