-->
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: SchemaUpdate/SchemaExport Problems
PostPosted: Wed Dec 19, 2007 12:25 pm 
Beginner
Beginner

Joined: Wed Dec 13, 2006 10:39 am
Posts: 26
Hibernate version: 3.2.2/b]

[b]Mapping documents:

Code:
<constraint>
   <set name="logs" lazy="true" inverse="true" cascade="save-update" sort="unsorted">
      <key column="log_action_id" on-delete="cascade">
      </key>
      <one-to-many
              class="com.seqis.kltm.model.db.project.logging.ProjectKLTMLog"
       />

   </set>
</constraint>


Code:
<update>
   <property name="createTAAutomatic" type="boolean" update="true" insert="true">
            <column name="create_ta_automatic" default="0"/>
   </property>
</update>


Name and version of the database you are using: MySQL 5.0, MSSQL 2000 8.00

The generated SQL (show_sql=true):
Creation:
-Mysql
Code:
    alter table kltm_log_values
        add index FK7BDAC42DE4A9234 (log_id),
        add constraint FK7BDAC42DE4A9234
        foreign key (log_id)
        references kltm_log (object_id)


-MSSQL
Code:
    alter table kltm_log_values
        add constraint FK7BDAC42DE4A9234
        foreign key (log_id)
        references kltm_log
        on delete cascade   


Update:
-Mysql
Code:
alter table kltm_project_settings add column create_ta_automatic bit default 0


-MSSQL
Code:
alter table kltm_project_settings add create_ta_automatic tinyint default 0 null


I have two problems.
The first problem concerns the schemaexporter: the "on-delete=cascade" option has no effect on mysql. on mssql, the foreign key is created with the "on delete cascade" option.

The second problem concerns the schemupdate: i added a new boolean property. on mysql the update is executed correctly with the default, on mssql the column is created but no default ist set. the sql shows a "null" on its end.

can anyone tell what i am doing wrong?

thx in advance


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 20, 2007 8:18 am 
Beginner
Beginner

Joined: Wed Dec 13, 2006 10:39 am
Posts: 26
alright, i resolved the problem with the foreign key and cascade delete on my own - if you use mysql5innodbdialect it works, with mysql5dialect foreign key with cascade delete are created.

i solved the second problem too... you have to add "not-null=true" to the mapping, then the generated sql statement looks like ".... default 1 not null" an that works.


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.