-->
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: Fixing 'foreign key FKCBF1E30F7EBC98FD' help needed
PostPosted: Wed Aug 24, 2005 9:57 am 
Beginner
Beginner

Joined: Fri Apr 15, 2005 3:30 pm
Posts: 46
Location: Fortaleza, Brazil
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0.5

Mapping documents:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
<class
name="com.siemens.swa.domain.ActivityStateLog"
table="ACTIVITY_STATE_LOG"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
lazy="true"
batch-size="6"
>

<id
name="id"
column="ACT_STA_LOG_ID"
type="java.lang.Long"
>
<generator class="native"/>
</id>

<many-to-one
name="user"
class="com.siemens.swa.domain.User"
cascade="none"
outer-join="auto"
update="true"
insert="true"
access="property"
column="USER_ID"
foreign-key="fk_activitystatelog_user"
/>

<property
name="date"
column="DATE"
/>

<property
name="state"
type="com.siemens.swa.dao.ActivityStateUserType"
update="true"
insert="true"
access="property"
column="STATE"
length="10"
/>

<property
name="substate"
type="com.siemens.swa.dao.ActivityExecutionStatusUserType"
update="true"
insert="true"
access="property"
column="SUBSTATE"
/>

</class>

</hibernate-mapping>


AND

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
<class
name="com.siemens.swa.domain.ActivityExecution"
table="ACTIVITY_EXECUTION"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
lazy="true"
batch-size="6"
>

<id
name="id"
column="ACT_EXECUTION_ID"
type="java.lang.Long"
>
<generator class="native"/>
</id>

<property
name="date"
column="DATE"
/>

<property
name="time"
column="TIME"
/>

<many-to-one
name="technician"
class="com.siemens.swa.domain.Technician"
cascade="none"
outer-join="auto"
access="property"
foreign-key="fk_activityexecution_technician"
column="TECHNICIAN_ID"
unique="false"
/>

<many-to-one
name="dispatcher"
class="com.siemens.swa.domain.Dispatcher"
cascade="none"
outer-join="auto"
access="property"
column="DISPATCHER_ID"
unique="false"
foreign-key="fk_activityexecution_dispatcher"
/>

<property
name="status"
type="com.siemens.swa.dao.ActivityExecutionStatusUserType"
update="true"
insert="true"
access="property"
column="STATUS"
not-null="true"
/>

<set
name="stateLog"
lazy="true"
cascade="all"
order-by="DATE ASC"
sort="unsorted"
batch-size="6"
outer-join="auto"
>
<key
column="ACT_EXECUTION_ID"
>
</key>

<one-to-many
class="com.siemens.swa.domain.ActivityStateLog"
/>
</set>

<list name="tracks" lazy="true" batch-size="6" outer-join="auto" table="TRACK_EXECUTION_INFO" cascade="all">
<key column="ACT_EXECUTION_ID"/>
<index column="TRK_EXEC_ORDER"></index>
<composite-element class="com.siemens.swa.domain.TrackingExecutionInfo">
<parent name="activityExecution"/>
<many-to-one name="trackingExecution"
class="com.siemens.swa.domain.TrackingExecution"
cascade="all"
column="TRK_EXECUTION_ID"
not-null="false"
outer-join="auto"/>
<many-to-one name="executionClosing"
class="com.siemens.swa.domain.ExecutionClosing"
cascade="all"
column="EXEC_CLOSING_ID"
not-null="false"
outer-join="auto"/>
</composite-element>
</list>

</class>

</hibernate-mapping>



Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

MySQL 4.1 without innodb

The generated SQL (show_sql=true):

alter table ACTIVITY_STATE_LOG drop foreign key fk_activitystatelog_user;
alter table ACTIVITY_STATE_LOG drop foreign key FKA7B11926170F6ACE;

...

alter table ACTIVITY_EXECUTION drop foreign key fk_activityexecution_dispatcher;
alter table ACTIVITY_EXECUTION drop foreign key fk_activityexecution_technician;

...

create table ACTIVITY_EXECUTION (ACT_EXECUTION_ID bigint not null auto_increment, DATE date, TIME time, TECHNICIAN_ID bigint, DISPATCHER_ID bigint, STATUS varchar(255) not null, primary key (ACT_EXECUTION_ID));

Debug level Hibernate log excerpt:

Hi all,

I've combed thru the archives and I can't seem to understand how to fix the problem in my case - the funky number that is being generated. My create.sql script is 600 lines so excuse if its too annotated - I'll post the whole thing if need be. I have 79 hbm files and lots of errors like these. We simply edit all the 'alter table' commands out, but we'd like to start using the foreign keys.

The common errors I seen here were incorrect column name and 'inverse' errors. However, I can't seem to see these errors here.

We want to use innodb, so we are interested in fixing this error.

Any ideas?
iksrazal


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 24, 2005 10:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the foreignkey name gets autogenerated unless you specify it the mappings via the foreign-key attribute.

_________________
Max
Don't forget to rate


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