|
Fornax-Platform
Forum |
|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
Defining Datasource Properties.Hey Guys,
I generated code with sculptor using version 1.6.Not sure where I need to define properties for my datasource. I see two files which refer to datasource. persistence.xml <non-jta-data-source>java:comp/env/jdbc/MyProjDS</non-jta-data-source> Also SessionFactory.xml has <prop key="hibernate.connection.datasource">java:jdbc/MyProjDS</prop> Where should I specify DB URL , driver and other properties like connection parameters for my datasource MyProjDS. Please post with an example. Thanks, Deepak. |
|
|
Re: Defining Datasource Properties.What properties do you use in sculptor-generator.properties?
Are you using Jboss? Then you define the datasource as a jboss mbean. Example: http://fornax.itemis.de/confluence/display/fornax/4.+Archetype+Tutorial+(CSC)#4.ArchetypeTutorial(CSC)-UseMySQLDatabase /Patrik
|
|
|
Re: Defining Datasource Properties.Patrik,
I'll be using jboss for my app.Actually I'll deploy my App war file on jboss and I wanted to keep the datasource bean within applicationcontext.xml. I assume I can just add a bean like below in applicationContext.xml. <bean id="MyProjDS" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="oracle.jdbc.OracleDriver" /> <property name="url" value="jdbc:oracle:thin:@localhost:1521:xe" /> <property name="username" value="myproj" /> <property name="password" value="password" /> </bean> Also I guess I would need to put a reference in SessionFactory.xml <prop key="hibernate.connection.datasource"><ref local="MyProjDS"/></prop> Let me know your thoughts? Thanks, Deepak.
|
|
|
Re: Defining Datasource Properties.Three alternatives
Alternative 1. You can define your own sessionFactory and datasource bean in more.xml These will be used instead of the generated SesssionFactory.xml If you find it confusing to have the sessionFactory bean defined in two places you can replace the the code generation like this... Alternative 2. To simply skip generation of SessionFactory.xml, and define it manually in src/main/resources you could can add this to SpecialCases.xpt: «AROUND templates::Spring::sessionFactory FOR Application» «ENDAROUND» Alternative 3. If you prefer to generate SessionFactory.xml with your own definition. In SpecialCases.xpt: «IMPORT sculptormetamodel» «EXTENSION extensions::helper» «EXTENSION extensions::properties» «AROUND templates::Spring::sessionFactory FOR Application» «EXPAND mySessionFactory» «ENDAROUND» «DEFINE mySessionFactory FOR Application» «FILE getResourceDir("spring") + getApplicationContextFile("SessionFactory.xml") TO_GEN_RESOURCES-» «EXPAND templates::Spring::header» «IF isWar() -» «EXPAND templates::Spring::txManager» «ENDIF -» «IF isJpaAnnotationToBeGenerated()» <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="myDataSource"/> <property name="configLocation" value="hibernate.cfg.xml"></property> «ELSE» <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="myDataSource" /> </property> «EXPAND templates::Spring::hibernateMappingResources» «ENDIF» <property name="entityInterceptor"> <ref bean="auditInterceptor" /> </property> </bean> <bean id="auditInterceptor" class="«auditInterceptorClass()»"/> </beans> «ENDFILE» «ENDDEFINE» Add myDataSource in more.xml Using this technique it is possible to change the generated output of most things. You need to look in the source code of the code generation templates to know what AROUNDs that can be done. Above is from Spring.xpt /Patrik |
|
|
Re: Defining Datasource Properties.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.
|
|
|
Re: Defining Datasource Properties.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
|
|
|
Re: Defining Datasource Properties.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@... https://lists.sourceforge.net/lists/listinfo/fornax-developer |
|
|
Re: Defining Datasource Properties.Hello,
please make default as best practices (not standards). That's reason why Sculptor is sooooo good (perfect). If, as you are writing: "it's a widely used practice to do this." than is better to have it as default ON. Please just reconsider. TNX Pavel On Thu, Jun 4, 2009 at 12:55 AM, Oliver Ringel <oringel@...> wrote: > 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@... > https://lists.sourceforge.net/lists/listinfo/fornax-developer > ------------------------------------------------------------------------------ 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@... https://lists.sourceforge.net/lists/listinfo/fornax-developer |
|
|
Re: Defining Datasource Properties.Hi Pavel,
sorry, but in this point I have to disagree. A widely used practice is not always the best practice. In my eyes configuring the datasource from outside of the application should be the prefered way. Therefore my vote is to keep the default OFF. regards, Oliver Am Donnerstag, den 04.06.2009, 10:43 +0200 schrieb Pavel Tavoda: > Hello, > please make default as best practices (not standards). That's reason > why Sculptor is sooooo good (perfect). If, as you are writing: "it's a > widely used practice to do this." than is better to have it as default > ON. Please just reconsider. > > TNX > > Pavel > > On Thu, Jun 4, 2009 at 12:55 AM, Oliver Ringel <oringel@...> wrote: > > 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@... > > https://lists.sourceforge.net/lists/listinfo/fornax-developer > > > > ------------------------------------------------------------------------------ > 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@... > https://lists.sourceforge.net/lists/listinfo/fornax-developer > ------------------------------------------------------------------------------ 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@... https://lists.sourceforge.net/lists/listinfo/fornax-developer |
|
|
Re: Defining Datasource Properties.OK, than is correct resource ref generated to web.xml?
<resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/XXXDS</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> Do we have some documentation how to deploy and what to change for different versions of Tomcat, Jetty, JBoss that should we lead deployers? Don't take my words offensive, I'm just asking. If not I should take over some parts. TNX Pavel On Thu, Jun 4, 2009 at 11:34 AM, Oliver Ringel <oringel@...> wrote: > Hi Pavel, > > sorry, but in this point I have to disagree. A widely used practice is > not always the best practice. In my eyes configuring the datasource from > outside of the application should be the prefered way. > > Therefore my vote is to keep the default OFF. > > regards, Oliver > > > Am Donnerstag, den 04.06.2009, 10:43 +0200 schrieb Pavel Tavoda: >> Hello, >> please make default as best practices (not standards). That's reason >> why Sculptor is sooooo good (perfect). If, as you are writing: "it's a >> widely used practice to do this." than is better to have it as default >> ON. Please just reconsider. >> >> TNX >> >> Pavel >> >> On Thu, Jun 4, 2009 at 12:55 AM, Oliver Ringel <oringel@...> wrote: >> > 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@... >> > https://lists.sourceforge.net/lists/listinfo/fornax-developer >> > >> >> ------------------------------------------------------------------------------ >> 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@... >> https://lists.sourceforge.net/lists/listinfo/fornax-developer >> > > > ------------------------------------------------------------------------------ > 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@... > https://lists.sourceforge.net/lists/listinfo/fornax-developer > ------------------------------------------------------------------------------ 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@... https://lists.sourceforge.net/lists/listinfo/fornax-developer |
|
|
Re: Defining Datasource Properties.Oliver/Patrik,
Thanks for your inputs.I am okk keeping the defaults but JPA is new for me so just struggling to understand how things needs to be configured in persistence.xml. I'll research on that and figure out datasource and other settings when using persistence.xml. It may be useful to include some links to these kinda things for users somewhere in dev guide.Just a thought! -Deepak.
|
|
|
Re: Defining Datasource Properties.Hi Pavel,
I think this is an optional entry. If you need, you can lookup the datasource (once correctly configured in Jetty, Tomcat and JBoss) without <resource-ref>. But it is a standard. Therefore my opinion is, that we should add support for <resource-ref>. You are right. The documentation for deployment is not complete and your help would be very welcome. regards, Oliver Am Donnerstag, den 04.06.2009, 12:22 +0200 schrieb Pavel Tavoda: > OK, than is correct resource ref generated to web.xml? > <resource-ref> > <description>DB Connection</description> > <res-ref-name>jdbc/XXXDS</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> > > Do we have some documentation how to deploy and what to change for > different versions of Tomcat, Jetty, JBoss that should we lead > deployers? Don't take my words offensive, I'm just asking. If not I > should take over some parts. > > TNX > > Pavel > > > On Thu, Jun 4, 2009 at 11:34 AM, Oliver Ringel <oringel@...> wrote: > > Hi Pavel, > > > > sorry, but in this point I have to disagree. A widely used practice is > > not always the best practice. In my eyes configuring the datasource from > > outside of the application should be the prefered way. > > > > Therefore my vote is to keep the default OFF. > > > > regards, Oliver > > > > > > Am Donnerstag, den 04.06.2009, 10:43 +0200 schrieb Pavel Tavoda: > >> Hello, > >> please make default as best practices (not standards). That's reason > >> why Sculptor is sooooo good (perfect). If, as you are writing: "it's a > >> widely used practice to do this." than is better to have it as default > >> ON. Please just reconsider. > >> > >> TNX > >> > >> Pavel > >> > >> On Thu, Jun 4, 2009 at 12:55 AM, Oliver Ringel <oringel@...> wrote: > >> > 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@... > >> > https://lists.sourceforge.net/lists/listinfo/fornax-developer > >> > > >> > >> ------------------------------------------------------------------------------ > >> 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@... > >> https://lists.sourceforge.net/lists/listinfo/fornax-developer > >> > > > > > > ------------------------------------------------------------------------------ > > 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@... > > https://lists.sourceforge.net/lists/listinfo/fornax-developer > > > > ------------------------------------------------------------------------------ > 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@... > https://lists.sourceforge.net/lists/listinfo/fornax-developer > ------------------------------------------------------------------------------ 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@... https://lists.sourceforge.net/lists/listinfo/fornax-developer |
| Free embeddable forum powered by Nabble | Forum Help |