Strong Liu, thanks for sharing the code. I have implemented first 2 points too, but looking at your code I have changed ServiceRegistry management in JDBCMetaDataConfiguration today.
If you are interested my code is here: https://github.com/dgeraskov/hibernate-tools/commits/move_to_hibernate4 I have found 1 memory leak in your code: it's in ServiceRegistryHelper map. Either you should use WeakReferences there or you should not use the Map<Configuration, ServiceRegistry> as every snippet: /JDBCMetaDataConfiguration config = new JDBCMetaDataConfiguration (); config.readFromJDBC();/ will create another key-value pair in the map. But the snippet is created for every exporters run. Another problem is that the ServiceRegistry implements ServiceRegistryImplementor it should be properly destroyed (this allows it to clean up system resources). And seems my code is also not free from the forgotten not stopped service registry. Dmitry 07/10/2011 16:15, Strong Liu wrote: > okay, i pushed it to my fork https://github.com/stliu/hibernate-tools master > branch > I didn't try to get rid of Configuration, since it's still the only way to > get to SF (new metamodel is not in place yet) > but there are others: > > 1. package change > 2. ServiceRegistry > 3. Junit 4 > > ----------- > Strong Liu<st...@hibernate.org> > http://hibernate.org > http://github.com/stliu > > On Oct 7, 2011, at 8:05 PM, Dmitry Geraskov wrote: > >> Hi, Strong Liu, >> >> can I somehow look at you "draft" hibernate tools for hibernate core 4 >> implementation? >> You said there are a lot of code should be rewritten, I guess you try to get >> rid of Configuration class. >> My approach was: minimal changes and still use the Configuration class. >> >> Dmitry Geraskov >> >> 06/10/2011 20:05, Strong Liu wrote: >>> I'm in the middle of moving hibernate tools to use hibernate4 >>> but there are too many codes need to be changed (well, almost all) >>> >>> I guess you won't like my pull request :( >>> >>> ----------- >>> Strong Liu<st...@hibernate.org> >>> http://hibernate.org >>> http://github.com/stliu >>> >>> On Oct 6, 2011, at 11:37 PM, Max Rydahl Andersen wrote: >>> >>>> On Sep 30, 2011, at 20:01, Gail Badner wrote: >>>> >>>>> There have been a couple of comments about problems with eclipse >>>>> integration with Hibernate 3.6.7: >>>>> - http://in.relation.to/Bloggers/HibernateCore367FinalRelease#comment21925 >>>>> - http://in.relation.to/Bloggers/HibernateCore367FinalRelease#comment22031 >>>>> >>>>> I don't use Eclipse myself. Does anyone have an answer? >>>> It's not just Eclipse, its any Hibernate tools usage that have the problem. >>>> >>>> Hibernate 3.6 breaks API so we can't build console configurations and >>>> session factories >>>> without recompiling and if we do that we won't work with Hibernate 3.2-3.5. >>>> >>>> Same problem with Hibernate 4. >>>> >>>> Now when Hibernate 4 is keeping Configuration it becomes somewhat more >>>> possible to support >>>> Hibernate 3.5 and Hibernate 4…but its rather messy unfortunately ;( >>>> >>>> Dima is working on solving some of this but its still very experimental. >>>> >>>> If anyone got time to help out we very much welcome it! >>>> >>>> /max >>>> http://about.me/maxandersen >>>> >>>> >>>> >>>> >>>> _______________________________________________ >>>> hibernate-dev mailing list >>>> hibernate-dev@lists.jboss.org >>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev >>> _______________________________________________ >>> hibernate-dev mailing list >>> hibernate-dev@lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/hibernate-dev _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev