Hi,

as Patrik said sculptor 1.6 will use JPA annotations and Hibernate
EntityManager for persistence as default. But it is still backward
compatible to 1.5 by setting the right properties. 

Sculptor had no intention to set the datasource as spring bean directly.
But it's a widely used practice to do this. Therefore I added a new
generator property.

In your sculptor-generator.properties you can set

  generate.spring.dataSourceSupport=true (default is false)

This will add the datasource to SessionFactory.xml/EntityManager.xml 
and some default properties to generated-spring.properties, e.g.

jdbc.dataSourceClassName=org.apache.commons.dbcp.BasicDataSource
jdbc.driverClassName=org.hsqldb.jdbcDriver
jdbc.url=jdbc:hsqldb:mem:<name of project>
jdbc.username=sa
jdbc.password=

You can easily override this properties in spring.properties. 

In case you need additional properties you can set them through
SpecialCases.xpt like this

«AROUND templates::Spring::dataSourceAdditions FOR Application»
            <property name="maxActive" value="50"/>  
«ENDAROUND»
        
And of course you can define your own datasource bean 

«AROUND templates::Spring::dataSource FOR Application»
        <bean id="dataSource" ... </bean>  
«ENDAROUND»
        

Setting the datasource via a spring bean will not work if you deploy a
jpa application as ear to jboss. The datasource must be set
in persistence.xml in this case.

I hope this is what you need.

regards, Oliver

Am Dienstag, den 02.06.2009, 23:14 -0700 schrieb Patrik Nordwall:
> If you are migrating a 1.5 project to 1.6 I assume you have read the
> migration guide:
> http://fornax.itemis.de/confluence/display/fornax/0.+What%27s+New+(CSC)#0.What%27sNew(CSC)-Version1.6.x
> 
> We have not completely updated the documentation in the Developer's Guide
> yet. 
> All properties are here:
> https://fornax.svn.sourceforge.net/svnroot/fornax/trunk/cartridges/sculptor/fornax-cartridges-sculptor-generator/src/main/resources/default-sculptor-generator.properties
> 
> The property you are looking for is:
> generate.jpa.sessionFactorySupport=true
> (still jpa annotations, but with SessionFactory.xml instead of
> persistence.xml)
> 
> I think our recommendation is to use sessionFactorySupport=false (as
> default), but then I don't know how to define the data source as a spring
> bean. 
> Oliver, what do you say about this topic?
> 
> /Patrik
> 
> 
> 
> deepshar027 wrote:
> > 
> > Patrik,
> > 
> > Thanks for that.I have a new problem now which is not related to this
> > thread.
> > Actually I deleted all my sources from src\generated\resources so that
> > they can be generated again when I run the workflow.
> > 
> > However when I run the workflow again , I dont see SessionFactory.xml ? I
> > guess earlier I was using sculptor version 1.5 and then switched to 1.6
> > .Is SessionFactory.xml not generated for 1.6?
> > If its not generated then where should be the datasource defined?
> > 
> > Let me know if there is any documentation available for details on various
> > sources generated.
> > 
> > 
> > Rgds,
> > Deepak. 
> > 
> 


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to