Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: How to do Schema Validation with JPA? Configuration needed.
PostPosted: Tue Feb 28, 2006 3:06 pm 
Beginner
Beginner

Joined: Mon Jan 09, 2006 3:05 pm
Posts: 24
Hibernate allows you to validate your configuration against a database with the SchemaValidator object. Its takes one input parameter, a Configuration.

In a JPA environment (Hibernate 3.1.1, Annotations 3.1B8, EntityManager 3.1B6) how can I retrieve the Configuration so that I can pass it into the validator? My configuration is specified with Annotations.

I know how to retrieve a SessionFactory from an EntityManagerFactory, or a Session from an EntityManager, but can't figure out how to get to the underlying hibernate configuration. I looked at the Hibernate Tools, and they don't support schema validation.

Thanks for any help.
--keenan


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 12:25 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7179
Location: Atlanta, USA
hibernate.hbm2ddl.auto validate does it,
otherwise I'll have to offer a possibility to get a Configuration out of an EJB3Configuration

_________________
Emmanuel
Check Hibernate Search in Action out


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 4:34 pm 
Beginner
Beginner

Joined: Mon Jan 09, 2006 3:05 pm
Posts: 24
Thanks as always Emmanuel, not just for your help on the forums, but for the JPA implementation itself. Your suggestion was just what I needed.

By putting
Code:
<property name="hibernate.hbm2ddl.auto" value="validate" />
into my persistence.xml file, I now get a boot time error from my JPA program pointing out the details of any skews between the code and the schema.
--keenan


Top
 Profile  
 
 Post subject: Re: How to do Schema Validation with JPA? Configuration needed.
PostPosted: Fri Apr 13, 2012 9:58 pm 
Newbie

Joined: Fri Apr 13, 2012 9:53 pm
Posts: 1
validate on server boot up is fine. but if i can have it as an ant task or as a mave pojo it woild be great since it will save my server boot up time.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 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.