Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  18 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rick R  
View profile  
 More options May 14 2012, 10:51 pm
From: Rick R <ric...@gmail.com>
Date: Mon, 14 May 2012 22:51:57 -0400
Local: Mon, May 14 2012 10:51 pm
Subject: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer

Wasted way too many hours on this today since I was looking everywhere
except for the Spring MyBatis setup as the culprit. I went away from using
a Java config for my MyBatis stuff since there were issues with the whole
issues of properties getting loaded and dealing with the Mapper scanner.

Now, apparently even defining the following messes with the whole setting
of properties using the PropertyPlaceholderConfigurer...

If the following is defined:

        <bean id="sqlSessionFactoryForBatch"
class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="oracleDS"/>
 <property name="typeAliasesPackage" value="com.ncs.domain"/>
<property name="typeHandlersPackage" value="com.ncs.typehandler"/>
 </bean>

<bean id="batchMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
 <property name="mapperInterface" value="com.ncs.batchmapper.BatchMapper"/>
<property name="sqlSessionTemplate">
 <bean class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactoryForBatch"/>
 <constructor-arg index="1" value="BATCH"/>
</bean>
 </property>
</bean>

 I will NOT get my properties set for my data source using the
ProeprtyPlaceholderConfigurer. (

       <context:property-placeholder
location="classpath:test-application.properties"/>

       <!--- NONE OF THESE WILL BE SET ! --->
<bean id="oracleDS" class="org.apache.commons.dbcp.BasicDataSource">
 <property name="url"  value="${oraUrl}"/>
<property name="username" value="${username}"/>
 .....
</bean>

According to the docs I realize these issues happened with the
MapperScanner http://www.mybatis.org/spring/mappers.html, but how do I
avoid it when just creating a standard MapperFactoryBean? MapperFactory
doesn't take an instance of sqlSessionFactoryBeanName like the
MapperScanner does?

Thanks!

--
Rick R


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rick R  
View profile  
 More options May 15 2012, 12:39 am
From: Rick R <ric...@gmail.com>
Date: Tue, 15 May 2012 00:39:44 -0400
Local: Tues, May 15 2012 12:39 am
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer

Note the same issue arises if you try to define another MapperScanner and
you still end up instantiating a SqlSessionTemplate with a reference to
sqlSessionFactory...

<!-- standard mappers -->
       <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.ncs.mapper"/>
 <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>

<!-- try to map a different package with batch mappers -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
 <property name="basePackage" value="com.ncs.batchmapper"/>
<property name="sqlSessionFactoryBeanName"
value="sqlSessionFactoryForBatch"/>
 </bean>

<bean id="sqlSessionFactoryForBatch"
class="org.mybatis.spring.SqlSessionFactoryBean">
 <property name="dataSource" ref="oracleDS"/>
<property name="typeAliasesPackage" value="com.ncs.domain"/>
 <property name="typeHandlersPackage" value="com.ncs.typehandler"/>
</bean>

   <!-- This coupled with the mapper above causes the problem -->
<bean id="batchSqlSessionTemplate"
class="org.mybatis.spring.SqlSessionTemplate">
 <constructor-arg index="0" ref="sqlSessionFactoryForBatch"/>
<constructor-arg index="1" value="BATCH"/>
 </bean>

--
Rick R

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eduardo Macarron  
View profile  
 More options May 15 2012, 11:07 am
From: Eduardo Macarron <eduardo.macar...@gmail.com>
Date: Tue, 15 May 2012 17:07:01 +0200
Local: Tues, May 15 2012 11:07 am
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
Hi Rick. I am sorry I have not much time to get deeply into this
issues so sorry if I overlook something important.

The scanner is a bean that runs early during the spring startup
process. It runs before the propertiesplaceholderconfigurer so there
may be a problem with the place holders and you already know. But this
cannot happen with a MapperFactoryBean because it is a normal bean an
will be started once the propertiesplaceholderconfigurer has finished
so the problem must be elsewhere...

2012/5/15 Rick R <ric...@gmail.com>:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rick R  
View profile  
 More options May 15 2012, 12:18 pm
From: Rick R <ric...@gmail.com>
Date: Tue, 15 May 2012 12:18:51 -0400
Local: Tues, May 15 2012 12:18 pm
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer

On Tue, May 15, 2012 at 11:07 AM, Eduardo Macarron <

eduardo.macar...@gmail.com> wrote:
> Hi Rick. I am sorry I have not much time to get deeply into this
> issues so sorry if I overlook something important.

> The scanner is a bean that runs early during the spring startup
> process. It runs before the propertiesplaceholderconfigurer so there
> may be a problem with the place holders and you already know. But this
> cannot happen with a MapperFactoryBean because it is a normal bean an
> will be started once the propertiesplaceholderconfigurer has finished
> so the problem must be elsewhere...

There definitely seems to be something odd going on though when you use a
combination of 1) multiple SqlSessionFactories and 2) mapper scanner and a
MapperFactoryBean definition.
For example, I'm trying to set up a simple example to show you what I'm
referring to, and based on this following code with more than one
SqlSessionFactoryBean defined... if you include the MapperFactoryBean as
part of the deployment, Spring can't decide which SqlSessionFactory to bind
to autowire as you can see in this highlighted screen shot:
https://img.skitch.com/20120515-s9w2t9eb2p1cu7qj3t46axehk.jpg  HOWEVER, the
odd thing is if I remove the MapperFactoryBean definition, then there are
no issues auto-wiring.

       <!-- THREE SqlSessionFactoryBeans -->
         <bean id="sqlSessionFactoryOne"
class="org.mybatis.spring.SqlSessionFactoryBean">
 <property name="dataSource" ref="dataSourceOne"/>
<property name="typeAliasesPackage"
value="net.learntechnology.empmaint.business.dbone.domain"/>
 </bean>

<bean id="sqlSessionFactoryTwo"
class="org.mybatis.spring.SqlSessionFactoryBean">
 <property name="dataSource" ref="dataSourceTwo"/>
<property name="typeAliasesPackage"
value="net.learntechnology.empmaint.business.dbone.domain"/>
 </bean>

<bean id="sqlSessionFactoryForBatch"
class="org.mybatis.spring.SqlSessionFactoryBean">
 <property name="dataSource" ref="dataSourceOne"/>
<property name="typeAliasesPackage"
value="net.learntechnology.empmaint.business.dbone.domain"/>
 </bean>

        <!--- MAPPER SCANNER, this should map sqlSessionFactoryOne to the
Mappers scanned.. so why complain about not knowing
         which sqlSessionFacotryBean to autowire when the MapperFactoryBean
is included below this definition
          --->

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
 <property name="basePackage"
value="net.learntechnology.empmaint.business.dbone.mapper"/>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactoryOne"/>
 </bean>

        <!--- *********** IF THESE ARE COMMENTED OUT BELOW then no issues
with the above -->

<bean id="batchMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface"
value="net.learntechnology.empmaint.business.BatchMapper"/>
 <property name="sqlSessionTemplate">
<bean class="org.mybatis.spring.SqlSessionTemplate">
 <constructor-arg index="0" ref="sqlSessionFactoryForBatch"/>
<constructor-arg index="1" value="BATCH"/>
 </bean>
</property>
</bean>

<bean class="net.learntechnology.empmaint.business.service.BatchService">
<property name="batchMapper" ref="batchMapper"/>
 </bean>

--
Rick R

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rick R  
View profile  
 More options May 15 2012, 12:42 pm
From: Rick R <ric...@gmail.com>
Date: Tue, 15 May 2012 12:42:27 -0400
Local: Tues, May 15 2012 12:42 pm
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer

Ok a bit more info... I removed the MapperScanner completely and now in
both apps (the original and the one I was going to provide as an example),
I defined *ALL* my mappers as MapperFactoryBeans and then the properties
get set just fine (after removing the MapperScannerConfigurer.) Using
MapperScannerConfigurer seems to mess with things.. even when I have it
defined as the docs point out using sqlSessionFactoryBeanName:

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.ncs.mapper"/>
 <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>

I think I'm going to have to just be safe and rely on defining all my
Mappers in my xml :(.. sort of stinks since it's now one more ugly piece of
xml to maintain, but oh well. Possibly others aren't running into this
since they:
1) Aren't defining multiple SqlSessionFactories and/or 2) aren't relying
on auto-wiring of things.

I'd be interested in other examples out there of people using the latest
spring and spring-mybatis with multiple SqlSessionFactories defined and
using the MapperScannerConfigurer and leveraging auto-wiring of mappers.

--
Rick R

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kurth, Felix  
View profile  
 More options Jan 24, 8:56 am
From: "Kurth, Felix" <Felix.Ku...@globalfoundries.com>
Date: Thu, 24 Jan 2013 14:56:40 +0100
Local: Thurs, Jan 24 2013 8:56 am
Subject: RE: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer

This problem/bug seems to be in the class
SqlSessionDaoSupport

It tries to autowire both, a sqlSessionFactory and a sqlSessionTemplate with @Autowired. If the later is found it will be used, regardless whether it belongs itself to the correct SqlSessionFactory. The requested SqlSession points to the wrong database in the end.

This will lead to the effect, that you cannot use SqlSessionTemplate and MapperScanner together if multiple databases/SqlSessionFactories are defined.
In my opinion, SqlSessionDaoSupport should not use @Autowired.

One can overcome this problem by disabling autowireing for the SqlSessionTemplate:

<bean id="batchExecutor" class="org.mybatis.spring.SqlSessionTemplate" autowire-candidate="false">
                        <constructor-arg index="0" ref="sqlSessionFactoryForDatabase1" />
                        <constructor-arg index="1" value="BATCH" />
</bean>

In your own service classes, you have to force autowireing with

@Resource(name="batchExecutor")
SqlSessionTemplate batchExecutor;

Felix

From: mybatis-user@googlegroups.com [mailto:mybatis-user@googlegroups.com] On Behalf Of Rick R
Sent: Dienstag, 15. Mai 2012 18:42
To: mybatis-user@googlegroups.com
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer

Ok a bit more info... I removed the MapperScanner completely and now in both apps (the original and the one I was going to provide as an example), I defined *ALL* my mappers as MapperFactoryBeans and then the properties get set just fine (after removing the MapperScannerConfigurer.) Using MapperScannerConfigurer seems to mess with things.. even when I have it defined as the docs point out using sqlSessionFactoryBeanName:

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
                        <property name="basePackage" value="com.ncs.mapper"/>
                        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
            </bean>

I think I'm going to have to just be safe and rely on defining all my Mappers in my xml :(.. sort of stinks since it's now one more ugly piece of xml to maintain, but oh well. Possibly others aren't running into this since they:
1) Aren't defining multiple SqlSessionFactories and/or 2) aren't relying on auto-wiring of things.

I'd be interested in other examples out there of people using the latest spring and spring-mybatis with multiple SqlSessionFactories defined and using the MapperScannerConfigurer and leveraging auto-wiring of mappers.

On Tue, May 15, 2012 at 12:18 PM, Rick R <ric...@gmail.com<mailto:ric...@gmail.com>> wrote:

On Tue, May 15, 2012 at 11:07 AM, Eduardo Macarron <eduardo.macar...@gmail.com<mailto:eduardo.macar...@gmail.com>> wrote:
Hi Rick. I am sorry I have not much time to get deeply into this
issues so sorry if I overlook something important.

The scanner is a bean that runs early during the spring startup
process. It runs before the propertiesplaceholderconfigurer so there
may be a problem with the place holders and you already know. But this
cannot happen with a MapperFactoryBean because it is a normal bean an
will be started once the propertiesplaceholderconfigurer has finished
so the problem must be elsewhere...

There definitely seems to be something odd going on though when you use a combination of 1) multiple SqlSessionFactories and 2) mapper scanner and a MapperFactoryBean definition.
For example, I'm trying to set up a simple example to show you what I'm referring to, and based on this following code with more than one SqlSessionFactoryBean defined... if you include the MapperFactoryBean as part of the deployment, Spring can't decide which SqlSessionFactory to bind to autowire as you can see in this highlighted screen shot: https://img.skitch.com/20120515-s9w2t9eb2p1cu7qj3t46axehk.jpg  HOWEVER, the odd thing is if I remove the MapperFactoryBean definition, then there are no issues auto-wiring.

       <!-- THREE SqlSessionFactoryBeans -->
         <bean id="sqlSessionFactoryOne" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSourceOne"/>
<property name="typeAliasesPackage" value="net.learntechnology.empmaint.business.dbone.domain"/>
</bean>

<bean id="sqlSessionFactoryTwo" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSourceTwo"/>
<property name="typeAliasesPackage" value="net.learntechnology.empmaint.business.dbone.domain"/>
</bean>

<bean id="sqlSessionFactoryForBatch" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSourceOne"/>
<property name="typeAliasesPackage" value="net.learntechnology.empmaint.business.dbone.domain"/>
</bean>

        <!--- MAPPER SCANNER, this should map sqlSessionFactoryOne to the Mappers scanned.. so why complain about not knowing
         which sqlSessionFacotryBean to autowire when the MapperFactoryBean is included below this definition
          --->

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="net.learntechnology.empmaint.business.dbone.mapper"/>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactoryOne"/>
</bean>

        <!--- *********** IF THESE ARE COMMENTED OUT BELOW then no issues with the above -->

<bean id="batchMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="net.learntechnology.empmaint.business.BatchMapper"/>
<property name="sqlSessionTemplate">
<bean class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactoryForBatch"/>
<constructor-arg index="1" value="BATCH"/>
</bean>
</property>
</bean>

<bean class="net.learntechnology.empmaint.business.service.BatchService">
<property name="batchMapper" ref="batchMapper"/>
</bean>

2012/5/15 Rick R <ric...@gmail.com<mailto:ric...@gmail.com>>:

--
Rick R

--
Rick R


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eduardo Macarron  
View profile  
 More options Jan 24, 10:37 am
From: Eduardo Macarron <eduardo.macar...@gmail.com>
Date: Thu, 24 Jan 2013 16:37:49 +0100
Local: Thurs, Jan 24 2013 10:37 am
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
Hi Felix,

If there is more than one factory then you cannot use autowire because
you need to specify which one should be injected in your mappers/daos.

Does it fail if you explicitly inject the right template?

2013/1/24 Kurth, Felix <Felix.Ku...@globalfoundries.com>:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kurth, Felix  
View profile  
 More options Jan 24, 11:07 am
From: "Kurth, Felix" <Felix.Ku...@globalfoundries.com>
Date: Thu, 24 Jan 2013 17:07:56 +0100
Local: Thurs, Jan 24 2013 11:07 am
Subject: RE: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer

Yes i explicitly wire it like this:

        <bean id="sqlSessionFactory_1" class="org.mybatis.spring.SqlSessionFactoryBean">
                <property name="dataSource" ref="dataSource_1" />
        </bean>

        <bean id="sqlSessionFactory_2" class="org.mybatis.spring.SqlSessionFactoryBean">
                <property name="dataSource" ref="dataSource_2" />
        </bean>

        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
                <property name="basePackage" value="basepackage1" />
                <property name="sqlSessionFactoryBeanName" value=" sqlSessionFactory_1" />
                <property name="annotationClass" value=" AnnotationClass1" />
                <property name="processPropertyPlaceHolders" value="true"></property>
        </bean>

        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
                <property name="basePackage" value=" basepackage2" />
                <property name="sqlSessionFactoryBeanName" value=" sqlSessionFactory_2" />
                <property name="annotationClass" value="AnnotationClass2" />
                <property name="processPropertyPlaceHolders" value="true"></property>
        </bean>

        <bean id="transactionManager_1"
                class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
                <property name="dataSource" ref="dataSource_1" />
                <qualifier value="quali_1"/>
        </bean>

        <bean id="transactionManager_2"
                class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
                <property name="dataSource" ref="dataSource_2" />
                <qualifier value="quali_2"/>
        </bean>

This works all fine up to this point.

Now if im including this bean into the ApplicationContext:

        <bean id="batchExecutor" class="org.mybatis.spring.SqlSessionTemplate" >
                <constructor-arg index="0" ref="sqlSessionFactory_1" />
                <constructor-arg index="1" value="BATCH" />
        </bean>

All mappers directing to database_2/sglSessionFactory_2 are now going to database_1. The reason is the Dual-Autowireing in SqlSessionDaoSupport.
The MapperScannerConfigurer now prefers the autowired sqlSessionTemplate over the explicitly wired sqlSessionFactory. It should be the other way around?
I even didn't see the point to use a sqlSessionTemplate template in SqlSessionDaoSupport at all, since it creates a template with the "sqlSessionFactory" anyways?

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eduardo Macarron  
View profile  
 More options Jan 24, 12:28 pm
From: Eduardo Macarron <eduardo.macar...@gmail.com>
Date: Thu, 24 Jan 2013 18:28:27 +0100
Local: Thurs, Jan 24 2013 12:28 pm
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
Are you using mybatis-spring 1.1.1?

There is a test with that exact scenario that passes OK.

http://mybatis.googlecode.com/svn/sub-projects/mybatis-spring/trunk/s...

2013/1/24 Kurth, Felix <Felix.Ku...@globalfoundries.com>:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kurth, Felix  
View profile  
 More options Jan 24, 3:10 pm
From: "Kurth, Felix" <Felix.Ku...@globalfoundries.com>
Date: Thu, 24 Jan 2013 21:10:50 +0100
Local: Thurs, Jan 24 2013 3:10 pm
Subject: RE: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
Yes, it's 1.1.1.

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eduardo Macarron  
View profile  
 More options Jan 24, 3:49 pm
From: Eduardo Macarron <eduardo.macar...@gmail.com>
Date: Thu, 24 Jan 2013 21:49:50 +0100
Local: Thurs, Jan 24 2013 3:49 pm
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
Felix, in that case, it would be really helpful that you can reproduce
your error using that post so we can have a look at it.

2013/1/24 Kurth, Felix <Felix.Ku...@globalfoundries.com>:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kurth, Felix  
View profile  
 More options Jan 25, 3:23 am
From: "Kurth, Felix" <Felix.Ku...@globalfoundries.com>
Date: Fri, 25 Jan 2013 09:23:28 +0100
Local: Fri, Jan 25 2013 3:23 am
Subject: RE: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
I've opened a case for the issue:

http://code.google.com/p/mybatis/issues/detail?id=763

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eduardo Macarron  
View profile  
 More options Jan 26, 2:31 am
From: Eduardo Macarron <eduardo.macar...@gmail.com>
Date: Sat, 26 Jan 2013 08:31:38 +0100
Local: Sat, Jan 26 2013 2:31 am
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
Hello again Felix,

Thanks for filling the issue. I think I managed to provide a fix for
it please give it a try.

Regarding the @Autoriwred annotations, I do also think they do more
harm than good.

We used them to autowire the factory beans generated by the scanner
but I think that can also be achieved by activating the autowire only
for that beans during its creation:

if (!explicitFactoryUsed && !explicitTemplateUsed) {
  definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);

}

The problem is that I am afraid that removing @Autowire is a breaking
change and it is too late for that. :(

2013/1/25 Kurth, Felix <Felix.Ku...@globalfoundries.com>:

...

read more »


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eduardo Macarron  
View profile  
 More options Jan 27, 3:56 am
From: Eduardo Macarron <eduardo.macar...@gmail.com>
Date: Sun, 27 Jan 2013 09:56:32 +0100
Local: Sun, Jan 27 2013 3:56 am
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
Felix, I think we can remove the @Autowire from setSqlSessionTemplate.
I hope that removes some of the know weird side effects.

Just a few people may be affected by the change so I think it is worth.

We are not so sure about removing also the @Autowire from
setSqlSessionFactory but are open to users opinion.

What do you think? Should we remove both for MyBatis-Spring 1.2.0?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kurth, Felix  
View profile  
 More options Jan 28, 5:04 am
From: "Kurth, Felix" <Felix.Ku...@globalfoundries.com>
Date: Mon, 28 Jan 2013 11:04:02 +0100
Local: Mon, Jan 28 2013 5:04 am
Subject: RE: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
Eduardo,
you're your code change seems to fix the issue. Thank you.

Yes, in my opinion these @Autowire annotations should be avoided. Both, from sqlSessionTemplate and sqlSessionFactory.

I would even go further and throw an exception if the user tries to wire both, a factory and a template since wiring both makes no sense and usually causes problems/undefined state.

BtW. in "SQLSessionTemplate" (trunk) there has been a function added
  @Override
  public void destroy() throws Exception {
    // fix to avoid Spring 3.2 complaining that calling close() fails
  }

This seems to work only with Spring 3.2, not with 3.1 as the pom requests.
Please remove "@Override" to fix this.

Cosmetic problem: In the code changes, your refer to the bug number 762, actually it's 763


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dridi Boukelmoune  
View profile  
 More options Jan 28, 5:57 am
From: Dridi Boukelmoune <dridi.boukelmo...@zenika.com>
Date: Mon, 28 Jan 2013 11:57:02 +0100
Local: Mon, Jan 28 2013 5:57 am
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
Hi Eduardo,

How hard would a migration be ?

It's probably simpler to break the compatibility and provide a
migration guide. Also most users probably work with a single
datasource so the impact might be minimal.

Best Regards,
Dridi

On Mon, Jan 28, 2013 at 11:04 AM, Kurth, Felix


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eduardo Macarron  
View profile  
 More options Jan 28, 10:03 am
From: Eduardo Macarron <eduardo.macar...@gmail.com>
Date: Mon, 28 Jan 2013 16:03:16 +0100
Local: Mon, Jan 28 2013 10:03 am
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
@Felix.

Thanks for notifying. I will remove the @Override. I suppose I left
the dependency in my workspace to Spring 3.2 by mistake.

@Dridi

Those that did not inject the factory explicitly will have an startup
error. Easy to diagnose and to fix though.

1.2 version is the right moment for a change.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Eduardo Macarron  
View profile  
 More options Jan 28, 10:08 am
From: Eduardo Macarron <eduardo.macar...@gmail.com>
Date: Mon, 28 Jan 2013 16:08:38 +0100
Local: Mon, Jan 28 2013 10:08 am
Subject: Re: More property setting woes ... even with MapperFactory and PropertyPlaceholderConfigurer
Felix, my pom is right, it points to spring 3.1.3. What exception you had?

2013/1/28 Eduardo Macarron <eduardo.macar...@gmail.com>:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »