-->
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.  [ 5 posts ] 
Author Message
 Post subject: Middlegen generates hbm xml without ids?
PostPosted: Wed Oct 29, 2003 8:25 pm 
Regular
Regular

Joined: Mon Oct 20, 2003 3:14 am
Posts: 53
Location: Sterling, VA, USA
I have a MySQL database I went thru middlegen to create mappings and then to the Hibernate CodeGenerator for the classes.

Figured this would be fast, if not pretty.

Well, it appears I'm getting Key fields that are being ignored in creating the XML files. DDL and XML example follow. Ideas?

-Joe

---------------------------------------------

DROP DATABASE IF EXISTS bb;

CREATE DATABASE bb;

CREATE TABLE bb.LanguageCode
(LanguageCode CHAR(2) NOT NULL,
PRIMARY KEY(LanguageCode)) TYPE=INNODB;

CREATE TABLE bb.LanguageProficiencyCode
(ProficiencyCode SMALLINT NOT NULL,
PRIMARY KEY(ProficiencyCode)) TYPE=INNODB;

CREATE TABLE bb.HairColorCode
(HairColorCode VARCHAR(10) NOT NULL,
PRIMARY KEY(HairColorCode)) TYPE=INNODB;


CREATE TABLE bb.EyeColorCode
(EyeColorCode VARCHAR(10) NOT NULL,
PRIMARY KEY(EyeColorCode)) TYPE=INNODB;


CREATE TABLE bb.EyeColorDesc
(EyeColorCode CHAR(10) NOT NULL,
INDEX eye_ind(EyeColorCode),
FOREIGN KEY (EyeColorCode) REFERENCES EyeColorCode(EyeColorCode) ON UPDATE CASCADE,
LanguageCode CHAR(2) NOT NULL,
INDEX lang_ind(LanguageCode),
FOREIGN KEY (LanguageCode) REFERENCES LanguageCode(LanguageCode) ON UPDATE CASCADE,
EyeColorDesc VARCHAR(20) NOT NULL,
PRIMARY KEY(EyeColorCode,LanguageCode)) TYPE=INNODB;


<?xml version="1.0" encoding="UTF-8"?>
<import class="cdata" />
<hibernate-mapping>

<!--
Created by Middlegen Hibernate plugin

http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->

<class
name="bb.hibernate.Eyecolordesc"
table="eyecolordesc"
>
<property
name="eyeColorDesc"
type="java.lang.String"
column="EyeColorDesc"
not-null="true"
length="20"
/>

<!-- associations -->
<!-- bi-directional many-to-one association to Languagecode -->
<many-to-one
name="languagecode"
class="bb.hibernate.Languagecode"
not-null="true"
>
<column name="LanguageCode" />
</many-to-one>
<!-- bi-directional many-to-one association to Eyecolorcode -->
<many-to-one
name="eyecolorcode"
class="bb.hibernate.Eyecolorcode"
not-null="true"
>
<column name="EyeColorCode" />
</many-to-one>

</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject: Aha
PostPosted: Wed Oct 29, 2003 8:42 pm 
Regular
Regular

Joined: Mon Oct 20, 2003 3:14 am
Posts: 53
Location: Sterling, VA, USA
I have the same problem David.

See topic "Middlegen generates hbm xml without ids?" for example DDL.

-Joe


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 30, 2003 2:11 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Thanks joe it is as I suspect. This is already fixed and working on my laptop for the r3 release code base. I plan to release it this weekend (or as soon as possible). There are a number of other enhancements etc and mappings that it will deal with. It is a big upgrade.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 30, 2003 3:48 am 
Regular
Regular

Joined: Mon Oct 20, 2003 3:14 am
Posts: 53
Location: Sterling, VA, USA
david wrote:
Thanks joe it is as I suspect. This is already fixed and working on my laptop for the r3 release code base. I plan to release it this weekend (or as soon as possible). There are a number of other enhancements etc and mappings that it will deal with. It is a big upgrade.


One question about r3:

I found it kind of irking that the classnames under r2 didn't follow my table names, at least as regard to capitalization.

Ex: EyeColorCode became Eyecolorcode.

Will r3 allow me to specify this type of thing>

>insert hopeful look<


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 30, 2003 4:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
As much as I would like to supply this change (as I have intended to do so since r1) it will take effort that I don't have time for right now. The names are generated by Middlegen and are used as is - (all that is really required is that I will have to build a map that maps Middlegen names to User supplied names). Sounds easy but the work gone into this release is significant and I know users are waiting so I have a hard release time set for this weekend.

It is targeted for r4 (as Gavin has asked for it aswell :-) ).


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.