-->
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.  [ 7 posts ] 
Author Message
 Post subject: Dynamically test a configuration
PostPosted: Tue Feb 28, 2006 8:34 am 
Newbie

Joined: Sat Dec 03, 2005 7:31 pm
Posts: 12
Location: Toulouse, France
Hi all,

I would like to know if there is any solution to test mappings efficiency on a database, when the Hibernate configuration was built dynamically ?

I looked everywhere in documentation, api, google,forum,etc. and I tried some methods of the SessionFactory class, but none of them throws any Exception when running.

My aim is to provide to user an interface for configuring DBMS and database used by Hibernate (with multiple JDBC drivers). So the application checks the server availability with JDBC, and then configures Hibernate to connect to it and check if database is well-formed (i.e. mappings can work with it). If database is not initialized, then it uses the hbm2ddl tool to generate it directly.

I know this case is not standard, but I think it's quite interesting.

Thank you,
Fred.

_________________
IceScrum project : Scrum projects management tool


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 28, 2006 8:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
look for schemavalidator which does some of this...but probably not complete - patches welcome

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 28, 2006 7:01 pm 
Newbie

Joined: Sat Dec 03, 2005 7:31 pm
Posts: 12
Location: Toulouse, France
Thanks a lot max,

It seems to work very well :)
It's the same for dynamic database generation with hbm2ddl :)

Thank you again ;)

_________________
IceScrum project : Scrum projects management tool


Top
 Profile  
 
 Post subject: how to validate mapping files using SchemaValidator
PostPosted: Mon Oct 23, 2006 8:02 am 
Newbie

Joined: Wed Sep 27, 2006 3:34 am
Posts: 7
Avangel/max,
I am trying to validate my mapping files by writing a tag in cfg file:
<property name="hibernate.hbm2ddl.auto">validate</property>.

but when I run my testcase, I get below Exception:
Initial SessionFactory creation failed.org.hibernate.HibernateException: Wrong column type: C_NCVRD_CHRG_AMT, expected: double precision.

My maping file contains:
Code:
<property name="drgDaysOfStay" column="C_DRG_LOS_DAYS" type="java.lang.Double"/>


Is it the right way to run SchemaValidator? Do we have any other ways?
Thanks in advance

_________________
koteshwar.venigalla@wipro.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 23, 2006 8:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes you are doing it correctly, but schemavalidator is not perfect.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: how to validate mapping files
PostPosted: Mon Oct 23, 2006 9:32 am 
Newbie

Joined: Wed Sep 27, 2006 3:34 am
Posts: 7
Thanks Max,
Since schemavalidator is not perfect, please tell me how I can validate my hbm files with schema.

_________________
koteshwar.venigalla@wipro.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 23, 2006 9:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well - submit patches to schemaexport is a good step ;)

..note i've added an hbmlint to hibernatetools which validate the schema (and more). hbmlint is planned to be more extendable/fixable so try that out if you have the desire. (look in jira for hbmlint)

_________________
Max
Don't forget to rate


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