Announcement Announcement Module
Collapse
No announcement yet.
Auxillary database-object & AnnotationConfiguration Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Auxillary database-object & AnnotationConfiguration

    Hi,

    I'm trying to use an Auxillary database-object, see, http://docs.jboss.org/hibernate/core...atabase-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.
    Last edited by killerlfc; Oct 11th, 2010, 06:10 AM.

  • #2
    Fixed:

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

    Comment

    Working...
    X