IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Java Discussion :

deux sessionFactory pour la même application


Sujet :

Spring Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Inscrit en
    Juillet 2007
    Messages
    456
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 456
    Par défaut deux sessionFactory pour la même application
    J'ai une application web qui contient plusieurs modules, chaque module est lui même une application web avec ces propres fichiers de conf et sa base de données. Pour l'instant j'ai que deux modules. J'ai donc crée deux applicationContext, j'ai crée deux datasource et deux sessionFactory. Mais quand j'essaye de me connecter via un interface de connexion à mon application sa m'affiche l'exception suivante (il y a derriere une requete à la base pour tester le couple login/mdp) :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    org.springframework.orm.hibernate3.HibernateQueryException: User is not mapped [from User as u where u.login='admin']; nested exception is org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User as u where u.login='admin']
    Caused by: 
    org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User as u where u.login='admin']
    	at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:181)
    	at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:110)
    	at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:93)
    	at org.hibernate.hql.ast.HqlSqlWalker.createFromElement(HqlSqlWalker.java:277)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3056)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:2945)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:688)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:544)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:251)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:183)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:134)
    	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
    	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
    	at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:94)
    	at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
    	at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
    	at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1650)
    	at org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:837)
    	at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
    	at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:835)
    	at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:827)
    	at com.ul.extranet.core.dao.UserDao.findByLogin(UserDao.java:208)
    	at com.ul.extranet.core.dao.UserDao.loadUserByUsername(UserDao.java:317)
    	at org.springframework.security.providers.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83)
    	at org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:121)
    	at org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
    	at org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
    	at com.ul.extranet.core.acegi.AuthenticationController.authenticate(AuthenticationController.java:173)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.apache.el.parser.AstValue.invoke(AstValue.java:172)
    	at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
    	at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
    	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
    	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
    	at javax.faces.component.UICommand.broadcast(UICommand.java:383)
    	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:447)
    	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
    	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
    	at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
    	at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17)
    	at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:94)
    	at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:54)
    	at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:26)
    	at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
    	at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:160)
    	at com.icesoft.faces.webapp.http.servlet.SessionDispatcher$1.service(SessionDispatcher.java:38)
    	at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
    	at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
    	at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:55)
    	at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:19)
    	at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
    	at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:91)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:56)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:359)
    	at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    	at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    	at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    	at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    	at org.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:87)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    	at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:268)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    	at org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    	at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
    	at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    	at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:371)
    	at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:174)
    	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:138)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:63)
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    	at java.lang.Thread.run(Unknown Source)
    20 nov. 2008 10:40:47 com.sun.faces.lifecycle.RenderResponsePhase execute
    INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
    sourceId=null[severity=(ERROR 2), summary=(Access denied. User is not mapped [from User as u where u.login='admin']; nested exception is org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User as u where u.login='admin']; nested exception is org.springframework.orm.hibernate3.HibernateQueryException: User is not mapped [from User as u where u.login='admin']; nested exception is org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User as u where u.login='admin'].), detail=(Access denied. User is not mapped [from User as u where u.login='admin']; nested exception is org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User as u where u.login='admin']; nested exception is org.springframework.orm.hibernate3.HibernateQueryException: User is not mapped [from User as u where u.login='admin']; nested exception is org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [from User as u where u.login='admin'].)]
    Et voila mes deux fichiers de conf Spring
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    <?xml version="1.0" encoding="UTF-8"?>
     
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:ws="http://jax-ws.dev.java.net/spring/core"
    	xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:aop="http://www.springframework.org/schema/aop"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xmlns:util="http://www.springframework.org/schema/util"
    	xsi:schemaLocation="
    	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    	http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    	http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
    	http://jax-ws.dev.java.net/spring/core https://jax-ws.dev.java.net/spring/core.xsd 
    	http://jax-ws.dev.java.net/spring/servlet https://jax-ws.dev.java.net/spring/servlet.xsd
    	http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
    	default-lazy-init="true">
     
     
    	<!-- ===================================================================================================== -->
    	<!-- ======================================DataSource Definition========================================== -->
    	<!-- ===================================================================================================== -->
    	<bean id="dataSourceOBM"
    		class="com.mchange.v2.c3p0.ComboPooledDataSource"
    		destroy-method="close">
    		<property name="driverClass">
    			<value>${obm.datasource.driver_class}</value>
    		</property>
    		<property name="jdbcUrl">
    			<value>${obm.datasource.url}</value>
    		</property>
    		<property name="user">
    			<value>${obm.datasource.username}</value>
    		</property>
    		<property name="password">
    			<value>${obm.datasource.password}</value>
    		</property>
    		<property name="acquireIncrement">
    			<value>3</value>
    		</property>
    		<property name="minPoolSize">
    			<value>1</value>
    		</property>
    		<property name="maxPoolSize">
    			<value>100</value>
    		</property>
    		<property name="maxStatementsPerConnection">
    			<value>100</value>
    		</property>
    		<property name="numHelperThreads">
    			<value>20</value>
    		</property>
    		<property name="preferredTestQuery">
    			<value>Select 1 from dual</value>
    		</property>
    		<property name="testConnectionOnCheckin">
    			<value>true</value>
    		</property>
    		<property name="idleConnectionTestPeriod">
    			<value>60</value>
    		</property>
    	</bean>
     
    	<!-- ===================================================================================================== -->
    	<!-- ===================================== Datadource property finder===================================== -->
    	<!-- ===================================================================================================== -->
    	<bean name="propertyFinder"
    		class="com.ul.extranet.core.config.DataSourcePreferencesPlaceholderConfigurer"
    		init-method="init">
    	</bean>
     
    	<!-- ===================================================================================================== -->
    	<!-- ================================== Hibernate SessionFactory Definition ============================== -->
    	<!-- ===================================================================================================== -->
    	<bean id="sessionFactoryOBM"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSourceOBM" />
    		</property>
     
    		<!-- <property name="mappingResources">
    			<ref bean="mappingResources"/>			
    			</property>
    		-->
    		<property name="mappingLocations"
    			value="classpath:**/mapping/*.hbm.xml" />
     
    		<property name="hibernateProperties">
    			<props>
    				<prop key="current_session_context_class">thread</prop>
    				<prop key="hibernate.dialect">
    					${obm.datasource.dialect}
    				</prop>
     
    				<!-- Mise a false pour eviter les affichages des requetes SQL -->
    				<prop key="hibernate.show_sql">false</prop>
    				<prop key="hibernate.generate_statistics">false</prop>
    				<prop key="hibernate.cache.use_query_cache">false</prop>
    				<prop
    					key="hibernate.bytecode.use_reflection_optimizer">
    					true
    				</prop>
     
    				<prop key="hibernate.connection.release_mode">
    					auto
    				</prop>
     
    				<prop key="hibernate.cache.provider_class">
    					org.hibernate.cache.EhCacheProvider
    				</prop>
     
    				<prop
    					key="hibernate.cache.provider_configuration_file_resource_path">
    					/ehcache.xml
    				</prop>
     
    				<prop key="hibernate.cache.use_second_level_cache">
    					true
    				</prop>
     
    				<!--	
    					<prop key="hibernate.cache.use_minimal_puts">true</prop>					
    					<prop key="hibernate.default_batch_fetch_size">50</prop>
    				-->
     
    				<prop key="hibernate.hbm2ddl.auto">update</prop>
    			</props>
    		</property>
     
    	</bean>
     
     
    	<!-- ===================================================================================================== -->
    	<!-- ===================== Spring Data Access Exception Translator Defintion ============================= -->
    	<!-- ===================================================================================================== -->
    	<!--  -->
    	<bean id="jdbcExceptionTranslator"
    		class="org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator">
    		<property name="dataSource">
    			<ref bean="dataSourceOBM" />
    		</property>
    	</bean>
     
     
    	<!-- ===================================================================================================== -->
    	<!-- =================================== Hibernate Template Defintion ==================================== -->
    	<!-- ===================================================================================================== -->
    	<bean id="hibernateTemplate"
    		class="org.springframework.orm.hibernate3.HibernateTemplate">
    		<property name="sessionFactory">
    			<ref bean="sessionFactoryOBM" />
    		</property>
    		<property name="jdbcExceptionTranslator">
    			<ref bean="jdbcExceptionTranslator" />
    		</property>
    	</bean>
     
    	<!-- ===================================================================================================== -->
    	<!-- ================================ Hibernate Transaction Manager Defintion ============================ -->
    	<!-- ===================================================================================================== -->
    	<bean id="transactionManager"
    		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory">
    			<ref local="sessionFactoryOBM" />
    		</property>
    	</bean>
     
     
    	<!-- ===================================================================================================== -->
    	<!--=============enable the configuration of transactional behavior based on annotations ================= -->
    	<!-- ===================================================================================================== -->
    	<tx:annotation-driven transaction-manager="transactionManager"
    		proxy-target-class="true" />
     
    	<!-- ===================================================================================================== -->
    	<!-- ======================================= DAO Layer =================================================== -->
    	<!-- ===================================================================================================== -->
    	<bean id="DaoOrderBookImpl"
    		class="com.ul.extranet.module.orderBookMonitoring.dao.orderBook.DaoOrderBookImpl">
    		<property name="hibernateTemplate" ref="hibernateTemplate" />
    	</bean>
     
    	<!-- ===================================================================================================== -->
    	<!-- =================================== Service Layer =================================================== -->
    	<!-- ===================================================================================================== -->
    	<bean id="ServiceOrderBookImpl"
    		class="com.ul.extranet.module.orderBookMonitoring.service.orderBook.ServiceOrderBookImpl">
    		<property name="dao" ref="DaoOrderBookImpl" />
    	</bean>
     
     
    </beans>
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    <?xml version="1.0" encoding="UTF-8"?>
     
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:ws="http://jax-ws.dev.java.net/spring/core"
    	xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:aop="http://www.springframework.org/schema/aop"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xmlns:util="http://www.springframework.org/schema/util"
    	xsi:schemaLocation="
    	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    	http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    	http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
    	http://jax-ws.dev.java.net/spring/core https://jax-ws.dev.java.net/spring/core.xsd 
    	http://jax-ws.dev.java.net/spring/servlet https://jax-ws.dev.java.net/spring/servlet.xsd
    	http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
    	default-lazy-init="true">
     
     
    	<!-- ===================================================================================================== -->
    	<!-- ======================================DataSource Definition========================================== -->
    	<!-- ===================================================================================================== -->
    	<bean id="dataSource"
    		class="com.mchange.v2.c3p0.ComboPooledDataSource"
    		destroy-method="close">
    		<property name="driverClass">
    			<value>${core.datasource.driver_class}</value>
    		</property>
    		<property name="jdbcUrl">
    			<value>${core.datasource.url}</value>
    		</property>
    		<property name="user">
    			<value>${core.datasource.username}</value>
    		</property>
    		<property name="password">
    			<value>${core.datasource.password}</value>
    		</property>
    		<property name="acquireIncrement">
    			<value>3</value>
    		</property>
    		<property name="minPoolSize">
    			<value>1</value>
    		</property>
    		<property name="maxPoolSize">
    			<value>100</value>
    		</property>
    		<property name="maxStatementsPerConnection">
    			<value>100</value>
    		</property>
    		<property name="numHelperThreads">
    			<value>20</value>
    		</property>
    		<property name="preferredTestQuery">
    			<value>Select 1 from dual</value>
    		</property>
    		<property name="testConnectionOnCheckin">
    			<value>true</value>
    		</property>
    		<property name="idleConnectionTestPeriod">
    			<value>60</value>
    		</property>
    	</bean>
     
    	<!-- ===================================================================================================== -->
    	<!-- ===================================== Datadource property finder===================================== -->
    	<!-- ===================================================================================================== -->
    	<bean name="propertyFinder"
    		class="com.ul.extranet.core.config.DataSourcePreferencesPlaceholderConfigurer"
    		init-method="init">
    	</bean>
     
     
    	<!-- ===================================================================================================== -->
    	<!-- ============================================ Resource loader ======================================== -->
    	<!-- ===================================================================================================== -->
    	<bean id="resourceLoader" name="resourceLoader"
    		class="com.ul.extranet.core.config.ResourceLoader"
    		init-method="init" lazy-init="false">
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>
     
     
    	<!-- ===================================================================================================== -->
    	<!-- ================================== Hibernate SessionFactory Definition ============================== -->
    	<!-- ===================================================================================================== -->
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
     
    		<!-- <property name="mappingResources">
    			<ref bean="mappingResources"/>			
    			</property>
    		-->
    		<property name="mappingLocations"
    			value="classpath:**/model/*.hbm.xml" />
     
    		<property name="hibernateProperties">
    			<props>
    				<prop key="current_session_context_class">thread</prop>
    				<prop key="hibernate.dialect">
    					${core.datasource.dialect}
    				</prop>
     
    				<!-- Mise a false pour eviter les affichages des requetes SQL -->
    				<prop key="hibernate.show_sql">false</prop>
    				<prop key="hibernate.generate_statistics">false</prop>
    				<prop key="hibernate.cache.use_query_cache">false</prop>
    				<prop
    					key="hibernate.bytecode.use_reflection_optimizer">
    					true
    				</prop>
     
    				<prop key="hibernate.connection.release_mode">
    					auto
    				</prop>
     
    				<prop key="hibernate.cache.provider_class">
    					org.hibernate.cache.EhCacheProvider
    				</prop>
    				<prop
    					key="hibernate.cache.provider_configuration_file_resource_path">
    					/ehcache.xml
    				</prop>
     
    				<prop key="hibernate.cache.use_second_level_cache">
    					true
    				</prop>
     
    				<!--	
    					<prop key="hibernate.cache.use_minimal_puts">true</prop>					
    					<prop key="hibernate.default_batch_fetch_size">50</prop>
    				-->
     
    				<prop key="hibernate.hbm2ddl.auto">update</prop>
    			</props>
    		</property>
     
    	</bean>
     
     
    	<!-- ===================================================================================================== -->
    	<!-- ===================== Spring Data Access Exception Translator Defintion ============================= -->
    	<!-- ===================================================================================================== -->
    	<!--  -->
    	<bean id="jdbcExceptionTranslator"
    		class="org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    	</bean>
     
     
    	<!-- ===================================================================================================== -->
    	<!-- =================================== Hibernate Template Defintion ==================================== -->
    	<!-- ===================================================================================================== -->
    	<bean id="hibernateTemplate"
    		class="org.springframework.orm.hibernate3.HibernateTemplate">
    		<property name="sessionFactory">
    			<ref bean="sessionFactory" />
    		</property>
    		<property name="jdbcExceptionTranslator">
    			<ref bean="jdbcExceptionTranslator" />
    		</property>
    	</bean>
     
    	<!-- ===================================================================================================== -->
    	<!-- ================================ Hibernate Transaction Manager Defintion ============================ -->
    	<!-- ===================================================================================================== -->
    	<bean id="transactionManager"
    		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory">
    			<ref local="sessionFactory" />
    		</property>
    	</bean>
     
     
    	<!-- ===================================================================================================== -->
    	<!--=============enable the configuration of transactional behavior based on annotations ================= -->
    	<!-- ===================================================================================================== -->
    	<tx:annotation-driven transaction-manager="transactionManager"
    		proxy-target-class="true" />
     
    </beans>
    L'erreur vient à priori du mapping des objets métiers. Dans le premier fichier, j'ai :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <property name="mappingLocations"
    			value="classpath:**/model/*.hbm.xml" />
    et dans le deuxiéme j'ai
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <property name="mappingLocations"
    			value="classpath:**/mapping/*.hbm.xml" />
    C'est que j'ai deux modules, le mapping du premier module est dans le package xxx/mapping/ et le deuxieme est dans xxx/modele/

    A votre avis ça vient de ça ? qu'est ce que je dois faire a votre avis.

    Merci pour votre aide

  2. #2
    Membre éclairé
    Inscrit en
    Juillet 2007
    Messages
    456
    Détails du profil
    Informations forums :
    Inscription : Juillet 2007
    Messages : 456
    Par défaut
    il fallait pas avoir les meme noms de beans dans les deux fichiers (ex : jdbcExceptionTranslator)

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Deux diagrammes de classes pour une même application
    Par Hello_World dans le forum Diagrammes de Classes
    Réponses: 2
    Dernier message: 13/09/2009, 11h08
  2. Réponses: 11
    Dernier message: 30/06/2007, 04h34
  3. Réponses: 3
    Dernier message: 15/05/2007, 00h00
  4. Réponses: 5
    Dernier message: 30/01/2007, 13h23
  5. [POO] Deux constructeurs pour une même classe
    Par amika dans le forum Langage
    Réponses: 4
    Dernier message: 16/12/2006, 16h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo