[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-36?page=all ]
Max Rydahl Andersen closed HBX-36:
----------------------------------
Resolution: Incomplete
can't work in the current setup...
Allow Hibernate Console to start with precreated sessionfactory and
cfg
-----------------------------------------------------------------------
Key: HBX-36
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-36
Project: Hibernate Tools
Type: New Feature
Components: consoleconfiguration
Versions: 2.1
Environment: Hibern8ide with the hibernate-extensions-2.1.2
Reporter: Justin Spears
Priority: Trivial
Fix For: 3.2LATER
Attachments: Hibern8IDE.java.patch
I am not positive where to add this but have found it really useful.
Hope ya'll don't mind posting it here, as I am having trouble finding a mailing
list regarding this, so apologies in advance.
The idea is to use the springframework to launch Hibern8ide... This allows one to use
their normal spring configuration, and not have to use 2 sets of conf files (1 for spring
1 for hibern8ide) the diff is included, a few trivial changes...
adding a setSessionFactory and changing the session startup from
the config to look for the session.
(you can then do something like this to )
private static ApplicationContext ctx;
/** the args are applicationContext*.xml files **/
public static void main(String[] args) {
ctx = new ClassPathXmlApplicationContext(args);
LocalSessionFactoryBean lsfbr = LocalSessionFactoryBean)
ctx.getBean("&sessionFactory");
SessionFactoryImpl sfbr = (SessionFactoryImpl)
ctx.getBean("sessionFactory");
Configuration cfg = lsfbr.getConfiguration();
try {
Hibern8IDE.startWith( cfg, sfbr );
} catch (HibernateException e) {
e.printStackTrace();
}
}
227c227
< sf = configuration.buildSessionFactory();
---
> if (sf == null) sf =
configuration.buildSessionFactory();
233c233,234
< }
---
>
> }
336c337
< DefaultGraphCell target = (DefaultGraphCell)
class2Node.get(et.getPersistentClass());
---
> DefaultGraphCell target = (DefaultGraphCell)
class2Node.get(et.getAssociatedClass());
388a390,396
>
> h8ide.start();
> }
> public static void startWith(Configuration c, SessionFactory sf) throws
HibernateException {
> Hibern8IDE h8ide = new Hibern8IDE();
> h8ide.setSessionFactory(sf);
> h8ide.setConfiguration(c);
391d398
<
422c429,430
< mainWindow.show();
---
> // mainWindow.show();
> mainWindow.setVisible(true);
1040a1049,1060
> /**
> * @return Returns the sf.
> */
> public SessionFactory getSessionFactory() {
> return sf;
> }
> /**
> * @param sf The sf to set.
> */
> public void setSessionFactory(SessionFactory sf) {
> this.sf = sf;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira