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: Auxillary database-object & AnnotationConfiguration
PostPosted: Mon Oct 11, 2010 6:18 am 
Newbie

Joined: Mon Aug 31, 2009 6:46 am
Posts: 11
Hi,

I'm trying to use an Auxillary database-object, see, http://docs.jboss.org/hibernate/core/3. ... ase-object to alter some foreign keys, however it is never executed (even if I implement my own). I've tried stepping through the code, & I can see the mapping file is read, but there is nothing that runs the aux code.

Here is my setup:

Hibernate 3.3.2.GA
Hibernate Annotations 3.4.0.GA
Spring 3

Session Factory bean def:
Code:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
            destroy-method="destroy" >
        <property name="dataSource" ref="dataSource" />
        <property name="hibernateProperties" ref="hibernateProperties" />
        <property name="annotatedClasses" ref="annotatedClasses" />
        <property name="mappingResources" value="Event.hbm.xml" />
</bean>


Event.hbm.xml

Code:

<hibernate-mapping>

<database-object>

<create>
alter table event drop constraint FK_ASSET;
alter table event add constraint FK_ASSET foreign key ('asset_id') references asset('id') on delete set null;
</create>
<drop></drop>
</database-object>
</hibernate-mapping>


Can anybody help please???

Thanks in advance,

Kevin.


Top
 Profile  
 
 Post subject: Re: Auxillary database-object & AnnotationConfiguration
PostPosted: Mon Oct 11, 2010 8:41 am 
Newbie

Joined: Mon Aug 31, 2009 6:46 am
Posts: 11
Fixed:

hibernate.hbm2ddl.auto was set to update. Changing it to create-drop now makes it work.


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.