-->
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: Issue with Hibernate Oracle
PostPosted: Tue Apr 12, 2011 8:33 am 
Newbie

Joined: Tue Apr 12, 2011 7:50 am
Posts: 1
Hi,

I am facing below issue:

For eg: I am taking a simple example for 2 table
1. Table-> Someproject_For_Test_Hibernate_Model
2. Table-> Someproject_For_Test_Hibernate_Model_File

Columns of Someproject_For_Test_Model
ID(PK)
Name
Created_Date
Created_By

Attribute of Someproject_For_Test_Model
ID(PK)
Name
Created_Date
Created_By
Set<Someproject_For_Test_Model> Someproject_For_Test_Model_Someproject_For_Test_Model



Columns of Someproject_For_Test_Model
ID(PK)
Someproject_For_Test_Model_ID(FK)
Name
Created_Date
Created_By

Attributes of Someproject_For_Test_Model
ID(PK)
Name
Created_Date
Created_By


Relationship
Someproject_For_Test_Model_Someproject_For_Test_Model


We have one to many relationship between this tables and when we are trying to fetch the child record (Set<Someproject_For_Test_Model> Someproject_For_Test_Model_Someproject_For_Test_Model) we are getting the below error.


Issue is because hibernate generated SQL is taking attribute names which are having length more than 30 characters. And we have a criteria in our project to keep the attribute name more than 30 characters because of which oracle is giving this error. So, is there any way to instruct hibernate to take table's column name instead of attribute(pojo's attribute) name in the generated HQL.

========================

Error:
----------
Caused by: java.sql.SQLException: ORA-00972: identifier is too long

Genearted sql:
--------------
Hibernate: select security_u0_.SECURITY_USER_GROUP_ID as SECURITY1_586_7_, security_u0_.USER_GROUP_NAME as USER2_586_7_, security_u0_.USER_GROUP_DESC as USER3_586_7_, security_u0_.GROUP_TYPE_CODE as GROUP4_586_7_, security_u0_.STATE_EXCLUSIVE_FLAG as STATE5_586_7_, security_u0_.REASON_FOR_CHANGE as REASON6_586_7_, security_u0_.CREATED_BY as CREATED7_586_7_, security_u0_.CREATED_DATE as CREATED8_586_7_, security_u0_.MODIFIED_BY as MODIFIED9_586_7_, security_u0_.MODIFIED_DATE as MODIFIED10_586_7_, usergroupp1_.SECURITY_USER_GROUP_ID as SECURITY9_9_, usergroupp1_.USER_GROUP_PROFILE_ID as USER1_9_, usergroupp1_.USER_GROUP_PROFILE_ID as USER1_643_0_, usergroupp1_.CREATED_BY as CREATED2_643_0_, usergroupp1_.CREATED_DATE as CREATED3_643_0_, usergroupp1_.MODIFIED_BY as MODIFIED4_643_0_, usergroupp1_.MODIFIED_DATE as MODIFIED5_643_0_, usergroupp1_.SECURITYPROFILE_USERGROUPPROFILE1929 as SECURITY6_643_0_, usergroupp1_.SECURITYUSERGROUP_USERGROUPPROFILE424 as SECURITY7_643_0_, security_p2_.SECURITY_PROFILE_ID as SECURITY1_584_1_, security_p2_.PROFILE_NAME as PROFILE2_584_1_, security_p2_.PROFILE_DESC as PROFILE3_584_1_, security_p2_.STATE_EXCLUSIVE_FLAG as STATE4_584_1_, security_p2_.PUBLIC_ONLY_FLAG as PUBLIC5_584_1_, security_p2_.CREATED_BY as CREATED6_584_1_, security_p2_.CREATED_DATE as CREATED7_584_1_, security_p2_.MODIFIED_BY as MODIFIED8_584_1_, security_p2_.MODIFIED_DATE as MODIFIED9_584_1_, security_p2_.BUSINESSFUNCTION_SECURITYPROFILE1210 as BUSINES10_584_1_, security_p2_.TFACTSROLE_SECURITYPROFILE1984 as TFACTSROLE11_584_1_, security_p2_.ROLE_SECURITYPROFILE530 as ROLE12_584_1_, business_f3_.BUSINESS_FUNCTION_ID as BUSINESS1_90_2_, business_f3_.BUSINESS_FUNCTION_NAME as BUSINESS2_90_2_, business_f3_.BUSINESS_FUNCTION_CODE as BUSINESS3_90_2_, business_f3_.BUSINESS_FUNCTION_DESC as BUSINESS4_90_2_, business_f3_.BUSINESS_FUNCTION_CAT_CODE as BUSINESS5_90_2_, business_f3_.ASSIGN_RQD_READ_PRIV_FLAG as ASSIGN6_90_2_, business_f3_.ASSIGN_RQD_UPDATE_PRIV_FLAG as ASSIGN7_90_2_, business_f3_.ASSIGN_RQD_READ_PUB_FLAG as ASSIGN8_90_2_, business_f3_.ASSIGN_RQD_UPDATE_PUB_FLAG as ASSIGN9_90_2_, business_f3_.STATUS_CODE as STATUS10_90_2_, business_f3_.CREATED_BY as CREATED11_90_2_, business_f3_.CREATED_DATE as CREATED12_90_2_, business_f3_.MODIFIED_BY as MODIFIED13_90_2_, business_f3_.MODIFIED_DATE as MODIFIED14_90_2_, business_f3_.USE_CASE_NAME as USE15_90_2_, business_f3_.TFACTS_BUSINESS_FUNCTION_CODE as TFACTS16_90_2_, tfacts_rol4_.TFACTS_ROLE_ID as TFACTS1_623_3_, tfacts_rol4_.TFACTS_ROLE_NAME as TFACTS2_623_3_, tfacts_rol4_.TFACTS_ROLE_CODE as TFACTS3_623_3_, tfacts_rol4_.WORKITEM_ASSIGNABLE_FLAG as WORKITEM4_623_3_, tfacts_rol4_.STATE_ONLY_ROLE_FLAG as STATE5_623_3_, tfacts_rol4_.PUBLIC_AGENCY_ONLY_ROLE_FLAG as PUBLIC6_623_3_, tfacts_rol4_.CREATED_BY as CREATED7_623_3_, tfacts_rol4_.CREATED_DATE as CREATED8_623_3_, tfacts_rol4_.MODIFIED_BY as MODIFIED9_623_3_, tfacts_rol4_.MODIFIED_DATE as MODIFIED10_623_3_, tfacts_rol4_.ROLE_TFACTSROLE268 as ROLE11_623_3_, role5_.ROLE_ID as ROLE1_565_4_, role5_.ROLE_NAME as ROLE2_565_4_, role5_.ROLE_CODE as ROLE3_565_4_, role5_.WORKITEM_ASSIGNABLE_FLAG as WORKITEM4_565_4_, role5_.STATE_ONLY_ROLE_FLAG as STATE5_565_4_, role5_.PUBLIC_AGENCY_ONLY_ROLE_FLAG as PUBLIC6_565_4_, role5_.CREATED_BY as CREATED7_565_4_, role5_.CREATED_DATE as CREATED8_565_4_, role5_.MODIFIED_BY as MODIFIED9_565_4_, role5_.MODIFIED_DATE as MODIFIED10_565_4_, role6_.ROLE_ID as ROLE1_565_5_, role6_.ROLE_NAME as ROLE2_565_5_, role6_.ROLE_CODE as ROLE3_565_5_, role6_.WORKITEM_ASSIGNABLE_FLAG as WORKITEM4_565_5_, role6_.STATE_ONLY_ROLE_FLAG as STATE5_565_5_, role6_.PUBLIC_AGENCY_ONLY_ROLE_FLAG as PUBLIC6_565_5_, role6_.CREATED_BY as CREATED7_565_5_, role6_.CREATED_DATE as CREATED8_565_5_, role6_.MODIFIED_BY as MODIFIED9_565_5_, role6_.MODIFIED_DATE as MODIFIED10_565_5_, security_u7_.SECURITY_USER_GROUP_ID as SECURITY1_586_6_, security_u7_.USER_GROUP_NAME as USER2_586_6_, security_u7_.USER_GROUP_DESC as USER3_586_6_, security_u7_.GROUP_TYPE_CODE as GROUP4_586_6_, security_u7_.STATE_EXCLUSIVE_FLAG as STATE5_586_6_, security_u7_.REASON_FOR_CHANGE as REASON6_586_6_, security_u7_.CREATED_BY as CREATED7_586_6_, security_u7_.CREATED_DATE as CREATED8_586_6_, security_u7_.MODIFIED_BY as MODIFIED9_586_6_, security_u7_.MODIFIED_DATE as MODIFIED10_586_6_ from SECURITY_USER_GROUP security_u0_ left outer join USER_GROUP_PROFILE usergroupp1_ on security_u0_.SECURITY_USER_GROUP_ID=usergroupp1_.SECURITY_USER_GROUP_ID left outer join SECURITY_PROFILE security_p2_ on usergroupp1_.SECURITYPROFILE_USERGROUPPROFILE1929=security_p2_.SECURITY_PROFILE_ID left outer join BUSINESS_FUNCTION business_f3_ on security_p2_.BUSINESSFUNCTION_SECURITYPROFILE1210=business_f3_.BUSINESS_FUNCTION_ID left outer join TFACTS_ROLE tfacts_rol4_ on security_p2_.TFACTSROLE_SECURITYPROFILE1984=tfacts_rol4_.TFACTS_ROLE_ID left outer join ROLE role5_ on tfacts_rol4_.ROLE_TFACTSROLE268=role5_.ROLE_ID left outer join ROLE role6_ on security_p2_.ROLE_SECURITYPROFILE530=role6_.ROLE_ID left outer join SECURITY_USER_GROUP security_u7_ on usergroupp1_.SECURITYUSERGROUP_USERGROUPPROFILE424=security_u7_.SECURITY_USER_GROUP_ID where security_u0_.SECURITY_USER_GROUP_ID=?

=========================


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.