-->
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: Hibernate is attempting to alter tables!?!
PostPosted: Wed Apr 09, 2008 9:08 pm 
Newbie

Joined: Wed Apr 09, 2008 8:50 pm
Posts: 1
I have an entity that uses an @EmbeddedId to identify the composite primary keys. in that entity I have a @ManyToOne relationship to another entity that also has an @EmbeddedId to hold the composite primary keys.

If I allow hibernate to alter the tables in my derby database it will successfully run two queries against my two entity tables and populate the objects when I run my Find method. (<prop key="hibernate.generate_ddl">false</prop>)

However when I do not allow hibernate to alter the tables (or when I work in a DB2 database where I do not have alter access the first query fails for obvious reasons. (the full query is below)
Hibernate is trying to select two columns that do not exist:
productser0_.poParent_PSCO_ID as pscoParent13_17_,
productser0_.poParent_PRPD_ID as pscoParent14_17_,
These two columns are representative of the @EmbeddedId for the entite that I have my @ManyToOne tag on.

How can I prevent hibernate from trying to query nonexistant columns? is it a config issue or do I need a mapping restriction?

Thanks,

Derek

select
productser0_.PO_ID as PSCO1_17_,
productser0_.PD_ID as PRPD2_17_,
productser0_.POH_TRNS_NO as PSCOH3_17_,
productser0_.PO_DS as PSCO4_17_,
productser0_.PO_EFFT_FR_DT as PSCO5_17_,
productser0_.PO_EFFT_TO_DT as PSCO6_17_,
productser0_.PO_EXTC_IN as PSCO7_17_,
productser0_.PO_IMPLN_DT as PSCO8_17_,
productser0_.PO_NM as PSCO9_17_,
productser0_.poParent_PSCO_ID as pscoParent13_17_,
productser0_.poParent_PRPD_ID as pscoParent14_17_,
productser0_.POH_RCD_MNTN_ID as PSCOH10_17_,
productser0_.POH_RCD_MNTN_TS as PSCOH11_17_,
productser0_.PO_STA_CD as PSCO12_17_
from
APP.PMT_CO_HIST productser0_
where
productser0_.PO_ID=? and productser0_.PD_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.