-->
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.  [ 10 posts ] 
Author Message
 Post subject: length and not-null attributes in ddl2hbm
PostPosted: Wed Mar 03, 2004 4:22 am 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
Hi everyone,

can someone tell me why, when generating a set of hbm from a DB, some mapping files get the not-null attribute set in the <property> and some not?
I really can't figure out whay and when this does happen. Any logic in here, anyone ever faced the same issue?

Moreover, I'm using a bottom-up approach, i-e I'll never generate table from object, always the other way around. In this case have the length attribute any sense for me? As for not-null since anyway the constraints are implemeted on the DB level?

thanx for any hints!


Last edited by nodje on Tue Jun 03, 2008 5:39 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 5:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well I suppose you get not-null when you have not-null constraints on your DB columns?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 5:14 am 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
Hum, when I get the not-null attribute it really correspond to what is set in my table.

But if I try to ddl2hbm, say 2 tables, one might have the not-sull attribute set, the other not!!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 10:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
ddl2hbm is not being worked on from Hibernate v2.0 and onwards. Middlegen is to tool to use to do this job. Try it out - see downloads - latest is r4 on Hibernate SF download page.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 12:20 pm 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
Thanks for the hint.

It took me a while to get a working ant task though.
And I get this exception:
Code:
middlegen.MiddlegenException: Middlegen successfully connected to the database, but couldn't find any tables. Perhaps the specified schema or catalog is wrong? -Or maybe there aren't any tables in the database at all?

A nice one indeed, but acting on catalog or schema doesn't make any difference (I know I've got around 100 tbles in my DB :-))

Is it any better to work only with the plugin? (To be downloaded only from CVS, isn't it ?)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 12:31 pm 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
OOPs, vevermind, I gave up just to early.

I only had to remove the catalog and schema option from the middlegen task...

It's amazing, it does allow to specify exhaustively all Hibernate options...

Is there any way to save the organized schema though?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 8:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You can add the schema to the appropriate edit field for any selected table or you can set it in the hibernates plugin Ant script for global affect (I have not document it - Bad David Bad :-) ).
Try out:
Code:
databaseSchema="blar"

Under the hibernate tag in the Ant script.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 03, 2004 8:11 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Maybe I miss understood - Once you have move you model around and set any and all options it will be saved automatically by Middlegen so when you start it up next time it will be in the same state.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 04, 2004 5:25 am 
Regular
Regular

Joined: Fri Nov 07, 2003 6:31 am
Posts: 104
Location: Beijing, China
Yes it works, it saves the schema.
That's really great!

But the ant task attribute includeViews="true" doesn't work.
I need it. Is it deprecated or ??

About

Quote:
You can add the schema to the appropriate edit field for any selected table or you can set it in the hibernates plugin Ant script for global affect (I have not document it - Bad David Bad :-) ).
Try out:

databaseSchema="blar"


it looks very interesting but I don't understand it.

Could you reformulate it please?

thanks again,
nodje


Last edited by nodje on Tue Jun 03, 2008 5:38 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 04, 2004 10:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
DB View processing has been added recently so you will need the CVS version of Middlegen.


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