-->
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: Export Hibernate Configuration
PostPosted: Sun Jul 15, 2007 11:08 am 
Newbie

Joined: Thu Jun 28, 2007 1:46 pm
Posts: 7
Hi my friends,

I got a program using Hibernate, during the running time, I got to modify the Configuration (which initially loaded from hibernage.cfg.xml).

How can I export the configuration back into the config file for the next time using the program?

Thanks,
Binh


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 15, 2007 12:15 pm 
Newbie

Joined: Thu Jun 28, 2007 1:46 pm
Posts: 7
I got the solution using HibernateConfigurationExporter which is packed in the Hinbernate Tools 3.2 Beta 9. However, the exported file is lacked of information of Session Factory. What's wrong with it?

Here's my code:

Code:
Configuration config = OXMappingManager.getConfiguration();
HibernateConfigurationExporter exporter = new HibernateConfigurationExporter();
      
      FileWriter writer = new FileWriter(new File("config-exported.xml"));
      exporter.setConfiguration(config);
      exporter.setOutput(writer);
      exporter.start();
      writer.close();


The result:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
      "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
    </session-factory>
</hibernate-configuration>


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.