-->
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.  [ 4 posts ] 
Author Message
 Post subject: Reverse Engineered Classes all have getSessionFactory
PostPosted: Fri Jul 07, 2006 12:09 pm 
Newbie

Joined: Wed Jun 21, 2006 2:02 pm
Posts: 6
Location: Carlsbad, CA
Hibernate version: 3.1
Name and version of the database you are using: Oracle 10.2

I've reverse engineered a set of tables. Each of the Home objects created has its own getSessionFactory method. I'd like them all to use the HibernateUtil*.getSessionFactory method. How can I accomplish this in the reverse engineering process, without modifying the code after reverse engineering?

*
package com.fitness.max.pricing;

import org.hibernate.*;
import org.hibernate.cfg.*;

public class HibernateUtil {

private static final SessionFactory sessionFactory;

static {
try {
// Create the SessionFactory from hibernate.cfg.xml
sessionFactory = new Configuration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}

public static SessionFactory getSessionFactory() {
return sessionFactory;
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 07, 2006 6:56 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
customize the templates.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Templates?
PostPosted: Fri Jul 07, 2006 8:10 pm 
Newbie

Joined: Wed Jun 21, 2006 2:02 pm
Posts: 6
Location: Carlsbad, CA
Can you elaborate? I saw various references in the Forum to templates, but can't find anything specific. Are you referring to this, from the Tools Reference Documentation:
4.1.3.7. Generic Hibernate metamodel exporter (<hbmtemplate>)?
I see an option to use custom templates on the Code Generator, and assume this is referring to same. Are there any examples online?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 07, 2006 8:11 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes in the docs and on this forum. use the search functionallity.

_________________
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.  [ 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.