Posts

Showing posts from January, 2011

hibernate 3.6.0.FINAL and OSGi

Hibernate does not come OSGi enabled from jboss. That’s okay. We can use bundlor to fix that. Grab bundlor from springsource and execute the following commands to make them available in maven. You can also add these to a maven pom.xml to have them automatically run. Note that the commands below assume the jar is in a specific subdirectory and the output goes to another subdirectory. Just replace yourprefix with the prefix you want to use. Springsource likes to use com.springsource but pick your own. Then just use your maven dependency declaration as you normally would. bundlor.bat -i nonosgilibs/hibernate3.jar -o ./libs/hibernateuser.org.hibernate-3.6.0.Final.jar -m template-hibernate3.mf mvn install:install-file -Dfile=libs/hibernateuser.org.hibernate-3.6.0.Final.jar -DgroupId=org.hibernate -DartifactId=hibernateuser.org.hibernate -Dversion=3.6.0.Final -Dpackaging=jar bundlor.bat -i nonosgilibs/hibernate-jpa-2.0-api-1.0.0.Final.jar -o libs/hibernateuser.javax.persistence2-1.0.0.Final.

nhibernate, mapping attributes and spring.net LocalSessionFactoryObject

Wanted to use nhibernate with spring.net. Also wanted to annotate my entities with nhibernate attributes. But there was no LocalSessionFactoryObject that could understand mapping attributes. The class below understands attributes. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; using NHibernate.Mapping.Attributes; using NHibernate.Cfg; using NHibernate.Util; namespace Spring.Data.NHibernate { /// /// Local session factory object implementation that understands /// nhibernate attributed classes. /// public class AnnotatedLocalSessionFactoryObject : LocalSessionFactoryObject { /// /// List of annotated classes that should be scanned for nhibernate attribute information. /// The type and assembly should be listed for each entry. /// public virtual ArrayList AnnotatedClasses { get; set; } /// /// Whether the schemas are validated after serializatio