tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Bergoo <jacob.ber...@gmail.com>
Subject Re: Integration Tapestry 4.0 + Spring 2.0 + Hibernate 3.0 + JBoss 4.2
Date Mon, 04 Jun 2007 18:06:02 GMT

Hi Cesar,

the datasource is defined in the web.xml:

<!-- 
=========================== DATASOURCE
========================================================== 
-->

	<resource-ref>
		<res-ref-name>OracleDS</res-ref-name>
		<res-type>javax.sql.DataSource</res-type>
		<res-auth>Container</res-auth>
	</resource-ref>


we tie everything togeather in jboss_service.xml:

<?xml version="1.0" encoding="UTF-8"?>

<server>
	<mbean code="org.jboss.hibernate.jmx.Hibernate"
name="jboss.har:service=Hibernate">
		<attribute name="DatasourceName">java:OracleDS</attribute>
		<attribute
name="SessionFactoryName">java:/hibernate/InvestacorpSessionFactory</attribute>
		<attribute name="Dialect">org.hibernate.dialect.OracleDialect</attribute>
		<attribute name="CacheProviderClass">
		        org.hibernate.cache.HashtableCacheProvider
		</attribute>
	</mbean>
</server>

sorry if I confused you... I forgot to post that one..
Hope it helps,
Jacob






C├ęsar Augusto Mateus wrote:
> 
> Hi Jacob, a question perhaps some foo:
> 
> You construct a bean sessionFactory with
> org.springframework.jndi.JndiObjectFactoryBean,
> in addition your bean dataSource is also a
> org.springframework.jndi.JndiObjectFactoryBean.
> 
> My question is: it needs from bean sessionFactory the specification of a
> datasource, generally this datasourse is other bean, but in your case the
> bean dataSource is not referenced from the bean sessionFactory.
> 
> you would explain to me bean InvestacorpSessionFactory?
> 
> 
> 
> 
> On 6/1/07, Jacob Bergoo <jacob.bergoo@gmail.com> wrote:
>>
>>
>> Ci Cesar,
>>
>> I am using the JTA Transaction Manager. For me that was easier to use
>> JBoss
>> JTA then to try to turn it of and instead use the one Hibernate is
>> providing. I am not an expert on the Transaction Manager, but I assume
>> that
>> they are pritty much the same.
>>
>> In my applicationContaxt-persistence.xml I have this:
>>
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://www.springframework.org/schema/beans"
>>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>        xsi:schemaLocation="
>> http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
>>
>>         <!-- DATASOURCE -->
>>
>>         <bean id="dataSource"
>> class="org.springframework.jndi.JndiObjectFactoryBean">
>>                 <property name="jndiName">
>>                         <value>java:OracleDS</value>
>>                 </property>
>>         </bean>
>>
>>         <!-- TRANSACTIONS -->
>>
>>         <bean id="transactionManager"
>> class="org.springframework.transaction.jta.JtaTransactionManager">
>>                 <property name="transactionManagerName"
>> value="java:/TransactionManager"></property>
>>                 <property name="userTransactionName"
>> value="UserTransaction"></property>
>>         </bean>
>>
>>         <bean id="sessionFactory"
>> class="org.springframework.jndi.JndiObjectFactoryBean">
>>                 <property name="jndiName">
>>
>>                        
>> <value>java:/hibernate/InvestacorpSessionFactory</value>
>>                 </property>
>>         </bean>
>>
>>         <bean id="hibernateTemplate"
>> class="org.springframework.orm.hibernate3.HibernateTemplate">
>>                 <property name="sessionFactory">
>>                         <ref bean="sessionFactory"/>
>>                 </property>
>>         </bean>
>>
>>         <!-- BEAN MAPPING -->
>>        <bean id="somePojoDao"
>> class="com.mycompany.persistence.dao.somepojo.SomePojoDaoImpl">
>>                 <property name="hibernateTemplate">
>>                         <ref bean="hibernateTemplate"/>
>>                 </property>
>>         </bean>
>>
>>         ......
>>
>>
>> </beans>
>>
>> and my web.xml look like this:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <web-app id="Investacorp" version="2.4"
>>         xmlns="http://java.sun.com/xml/ns/j2ee"
>>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>         xsi:schemaLocation="
>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
>>
>>         <!-- WebApp_ID -->
>>         <display-name>MyCompany</display-name>
>>
>> <!--
>> ================================= SESSION TIME
>> ================================================
>> -->
>>
>>         <session-config>
>>                 <session-timeout>1200</session-timeout>
>>         </session-config>
>>
>> <!--
>> ================================= WELCOME FILE
>> =================================================
>> -->
>>
>>
>>         <welcome-file-list>
>>                 <welcome-file>index.html</welcome-file>
>>                 <welcome-file>index.jsp</welcome-file>
>>         </welcome-file-list>
>>
>>
>> <!--
>> ================================= ERROR PAGE
>> ===================================================
>> -->
>>
>>         <!-- Predefined Error page if runtime exceptions occur. Toggle
>> during
>> debugging  -->
>>         <error-page>
>>                 <exception-type>java.lang.RuntimeException
>> </exception-type>
>>                 <location>/CustomExceptionPage.html</location>
>>         </error-page>
>>
>>         <error-page>
>>                 <error-code>403</error-code>
>>                 <location>/AccessDeniedPage.html</location>
>>         </error-page>
>>
>>         <error-page>
>>                 <error-code>404</error-code>
>>                 <location>/CustomExceptionPage.html</location>
>>         </error-page>
>>
>> <!--
>> =========================== DATASOURCE
>> ==========================================================
>> -->
>>
>>         <resource-ref>
>>                 <res-ref-name>OracleDS</res-ref-name>
>>                 <res-type>javax.sql.DataSource</res-type>
>>                 <res-auth>Container</res-auth>
>>         </resource-ref>
>>
>>
>> <!--
>> =========================== LISTENER
>> ==========================================================
>> -->
>>
>>         <listener>
>>
>> <listener-class>org.springframework.web.context.ContextLoaderListener
>> </listener-class>
>>         </listener>
>>
>>         <context-param>
>>             <param-name>contextConfigLocation</param-name>
>>             <param-value>/WEB-INF/applicationContext*.xml</param-value>
>>         </context-param>
>>
>> <!--
>> =========================== MVC APPLICATION CONTROLLER
>> ==========================================================
>> -->
>>
>>         <servlet>
>>         <servlet-name>MY_SERVLET_NAME</servlet-name>
>>
>> <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
>>         <load-on-startup>0</load-on-startup>
>>         </servlet>
>>
>>         <!-- Servlet Mapping for Acegi Security Framework to work with
>> Tapestry -->
>>
>>     <servlet-mapping>
>>         <servlet-name>MY_SERVLET_NAME</servlet-name>
>>         <url-pattern>/index.html</url-pattern>
>>     </servlet-mapping>
>>
>>     <servlet-mapping>
>>         <servlet-name>MY_SERVLET_NAME</servlet-name>
>>         <url-pattern>*.html</url-pattern>
>>     </servlet-mapping>
>>
>>     <servlet-mapping>
>>         <servlet-name>MY_SERVLET_NAME</servlet-name>
>>         <url-pattern>*.direct</url-pattern>
>>     </servlet-mapping>
>>     <servlet-mapping>
>>         <servlet-name>MY_SERVLET_NAME</servlet-name>
>>         <url-pattern>*.sdirect</url-pattern>
>>     </servlet-mapping>
>>     <servlet-mapping>
>>         <servlet-name>MY_SERVLET_NAME</servlet-name>
>>         <url-pattern>*.svc</url-pattern>
>>     </servlet-mapping>
>>
>> <!--
>> =========================== SECURING HTML AND PAGE FILES
>> ========================================================
>> -->
>>
>>         <security-constraint>
>>                 <display-name>Prevent access to raw *.html, *.css,
>> *.page,
>> *.js
>> files.</display-name>
>>                 <web-resource-collection>
>>                         <web-resource-name>Tapestry
>> Pages</web-resource-name>
>>                         <url-pattern>/html/*</url-pattern>
>>                 </web-resource-collection>
>>                 <auth-constraint>
>>                         <description>No roles, so no direct
>> access</description>
>>                 </auth-constraint>
>>         </security-constraint>
>>
>> <!--
>>
>> =================================================================================================
>> -->
>>
>> </web-app>
>>
>> If you have any more questions just feel free to ask...
>>
>> Cheers,
>> Jacob
>> --
>> View this message in context:
>> http://www.nabble.com/Integration-Tapestry-4.0-%2B-Spring-2.0-%2B-Hibernate-3.0-%2B-JBoss-4.2-tf3849055.html#a10915784
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Integration-Tapestry-4.0-%2B-Spring-2.0-%2B-Hibernate-3.0-%2B-JBoss-4.2-tf3849055.html#a10954827
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Mime
View raw message