I'm going to use org.hibernate.Version.getVersionString() to detect a Hibernate 3.x provider versus 4.x.
This is currently [WORKING] in 4.0.0.Beta4/Beta5. Would be good to have it correct for the next 4.x build. On 07/18/2011 04:39 AM, Emmanuel Bernard wrote: > You can use org.hibernate.Version.getVersionString() > which is the version number + qualifier OR [WORKING] when a snapshot is used. > > Emmanuel > > On 16 juil. 2011, at 19:56, Scott Marlow wrote: > >> It doesn't cause me great pain to not have this, would just make a few >> AS integration tasks simpler (when dealing with multiple versions of >> Hibernate). >> >> I understand that there are more environments than just AS. For AS7, it >> was more because I am using the persistence provider class name as a key >> (in a hash map). I really should be using a composite key that includes >> a version number but I don't have one (maybe I should look for one >> inside the persistence provider jar and use the version information if >> found). >> >> On 07/16/2011 01:07 PM, Steve Ebersole wrote: >>> I am personally against this idea. You mention renaming one single >>> class, but in reality we would need different FQNs for each and every >>> class otherwise we run into a clash in the class loader as to which one >>> wins (the one from hibernate4 jar or the one from hibernate3 jar). >>> >>> This is a bad path to start down. >>> >>> As an illustration, we had the same issue with JBoss Cache for some >>> time and we simply had 2 sub-projects, one for each version. Which in >>> my mind is the perfectly reasonable approach. >>> >>> On Fri 15 Jul 2011 08:55:23 AM CDT, Scott Marlow wrote: >>>> If someone wanted to include both Hibernate 3 + Hibernate 4 in the same >>>> project, that might be easier if the Hibernate 4 artifacts had a version >>>> number in it or was changed for every new major release. I don't think >>>> Maven supports building two versions of the same artifact (at the same >>>> dependency level). >>>> >>>> For the persistence provider name, >>>> org.hibernate.ejb.HibernatePersistence, I'm wondering if we could have a >>>> org.hibernate.ejb.HibernatePersistence4 in addition, that could be used >>>> to uniquely reference Hibernate 4.x persistence providers. >>>> >>>> I assume this is too late in the Hibernate 4 cycle to change, but wanted >>>> to bring the idea up. >>>> >>>> Changing the artifact names would impact other projects that depends on >>>> Hibernate4 and would need to sync up with the changes as well. >>>> >>>> What do you think? >>>> >>>> Scott >>>> _______________________________________________ >>>> 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