-->
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: Not able to generate hibernate mapping files
PostPosted: Wed Mar 04, 2009 3:46 am 
Newbie

Joined: Wed Mar 04, 2009 3:26 am
Posts: 1
Hi,

I am using hibernate tools 3.2.2 Beta for code generation.

I am not able to generate hibernate mapping files for the tables with kind of constaints. Example could be,

Table : EAI_SS_LOOKUP

Columns :
STYLESHEET_ID
ENDPOINT_ID

Constraints:

Constraint Name |Key Type |Columns
---------------------------------------------------------------------------------
QUEUE_ID |Primary |STYLESHEET_ID,ENDPOINT_ID
R_108 |Foreign |STYLESHEET_ID ON EAI_STYLESHEET
R_115 |Foreign |ENDPOINT_ID ON EAI_ENDPOINT

I tried multiple combinations in reverse engineering file but was not able to resolve this issue. The error I am getting while generating code is :
----------
==> foreach keyproperty in property.value.propertyIterator [on line 58, column 5 in hbm/id.hbm.ftl]
in include "id.hbm.ftl" [on line 72, column 2 in hbm/persistentclass.hbm.ftl]
in include "persistentclass.hbm.ftl" [on line 34, column 1 in hbm/hibernate-mapping.hbm.ftl]
----------

Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression property.value.propertyIterator is undefined on line 58, column 30 in hbm/id.hbm.ftl.

Please help me out.This is very critical. I dont want to write mapping files for 50 tables :((


Top
 Profile  
 
 Post subject: Post subject: Not able to generate hibernate mapping files
PostPosted: Fri Mar 27, 2009 10:15 am 
Newbie

Joined: Fri Mar 27, 2009 10:09 am
Posts: 1
Hi,

i have the same problem

i try to change id.hbm.xml in hibernatetools/hbm

to this one, and naw it's work

the change is in this line <#foreach keyproperty in c2h.getProperties(property.value)>


========================================
<#if embeddedid?exists>
<composite-id>
<#foreach keyproperty in embeddedid.propertyIterator>
<#if !c2h.isManyToOne(keyproperty)>
<key-property name="${keyproperty.name}" type="${keyproperty.value.typeName}">
<#foreach column in keyproperty.columnIterator>
<#include "pkcolumn.hbm.ftl">
</#foreach>
</key-property>
<#else>
<key-many-to-one name="${keyproperty.name}" class="${c2j.getJavaTypeName(keyproperty, false)}">
<#foreach column in keyproperty.columnIterator>
<#include "pkcolumn.hbm.ftl">
</#foreach>
</key-many-to-one>
</#if>
</#foreach>
</composite-id>
<#elseif !c2j.isComponent(property)>
<id
name="${property.name}"
type="${property.value.typeName}"
<#if c2h.isUnsavedValue(property)>
unsaved-value="${c2h.getUnsavedValue(property)}"
</#if>
<#if !property.basicPropertyAccessor>
access="${property.propertyAccessorName}"
</#if>
>
<#assign metaattributable=property>
<#include "meta.hbm.ftl">

<#foreach column in property.columnIterator>
<#include "pkcolumn.hbm.ftl">
</#foreach>
<#if !c2h.isIdentifierGeneratorProperties(property)>
<generator class="${property.value.identifierGeneratorStrategy}" />
<#else>
<generator class="${property.value.identifierGeneratorStrategy}">
<#assign parameters = c2h.getIdentifierGeneratorProperties(property)>
<#foreach paramkey in c2h.getFilteredIdentifierGeneratorKeySet(property)>
<param name="${paramkey}">${parameters.get(paramkey)}</param>
</#foreach>
</generator>
</#if>
</id>
<#else>
<composite-id
name="${property.name}"
class="${property.value.getComponentClassName()}"
<#if c2h.isUnsavedValue(property)>
unsaved-value="${c2h.getUnsavedValue(property)}"
</#if>
<#if !property.basicPropertyAccessor>
access="${property.propertyAccessorName}"
</#if>
>
<#foreach keyproperty in c2h.getProperties(property.value)>
<#if !c2h.isManyToOne(keyproperty)>
<key-property name="${keyproperty.name}" type="${keyproperty.value.typeName}">
<#foreach column in keyproperty.columnIterator>
<#include "pkcolumn.hbm.ftl">
</#foreach>
</key-property>
<#else>
<key-many-to-one name="${keyproperty.name}" class="${c2j.getJavaTypeName(keyproperty, false)}">
<#foreach column in keyproperty.columnIterator>
<#include "pkcolumn.hbm.ftl">
</#foreach>
</key-many-to-one>
</#if>
</#foreach>
</composite-id>
</#if>


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.