-->
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: Many-to-one hibernate mapping for sybase
PostPosted: Tue Jun 04, 2013 8:47 am 
Newbie

Joined: Wed May 15, 2013 3:01 am
Posts: 5
Hi,

<class name="com.icreate.platform.usermanagement.artefact.dto.VyasaArtefactPrivilegeRightsFact" table="VyasaArtefactPrivilegeFact">

<id name="artefactPrivilegeFactID" column="ArtefactPrivilegeFactID"/>
<property name="artefactID" column="ArtefactID"/>
<property name="roleID" column="RoleID"/>
<property name="roleDefinitionID" column="RoleDefinitionID"/>
<property name="privilegeValue" column="PrivilegeValue"/>

<many-to-one name="artefact"
class="com.icreate.platform.usermanagement.artefact.dto.VyasaArtefact"
column="artefactID"
not-null="true"
insert="false"
update="false" />


<many-to-one name="role"
class="com.icreate.platform.usermanagement.role.dto.VyasaRole"
column="roleId"
not-null="false"
insert="false"
update="false" />

<many-to-one name="roleDefinition"
class="com.icreate.platform.usermanagement.roledefinition.dto.VyasaRoleDefinition"
column="roleDefinitionID"
not-null="false"
insert="false"
update="false" />

</class>



The above mapping is working fine with Oracle but now If Iam using the same mapping for Sybase, Iam getting below exception
Hibernate: select vyasaroled0_.ProductLinkID as ProductL1_24_, vyasaroled0_.RoleID as RoleID24_, vyasaroled0_.ProductID as ProductID24_, vyasaroled0_.RoleDefinitionID as RoleDefi4_24_, vyasaroled0_.IsDefault as IsDefault24_, vyasaroled0_.productID as productID24_ from VyasaRoleDefRoleProductLink vyasaroled0_ where vyasaroled0_.RoleDefinitionID=? and vyasaroled0_.IsDefault=1
2013-06-04 11:36:20,374 WARN [org.hibernate.util.JDBCExceptionReporter] - SQL Error: 13836, SQLState: 42W60
2013-06-04 11:36:20,374 ERROR [org.hibernate.util.JDBCExceptionReporter] - SQL Anywhere Error -830: Alias 'ProductID24_' is not unique
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2235)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
at org.hibernate.loader.Loader.list(Loader.java:2124)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149)



So to eliminate the non unique alias exception I removed

<property name="artefactID" column="ArtefactID"/>
<property name="roleID" column="RoleID"/>
<property name="roleDefinitionID" column="RoleDefinitionID"/>



properties in above mapping. Now Iam not getting any Exception but When ever I do insert in to that table artefactID, roleId and roleDefinitionID are inserted as NULL since they are not part of Hibernate mapping.


Kinldy help me out in this. It is quite urgent.

Thanks,
Mohana Priya.


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.