How use Google Guice with SqlSessionFactoryProvider in a web app

63 views
Skip to first unread message

Fabrizio Starred

unread,
Apr 2, 2012, 6:04:30 PM4/2/12
to google...@googlegroups.com
I was searching for a smart example of dependancy injection of the SqlSessionFactory, as the mybatis manual suggested.

I have already gave a look of other examples on the site, but none show me the simple stuff I need, also because I would not inject the mappers too.

Anyone can help me ?

Josh Kamau

unread,
Apr 3, 2012, 3:18:35 AM4/3/12
to google...@googlegroups.com
Why not use mybatis-guice project.  There is a detailed user guide on how to use.

Regards.
Josh.

--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/uznbuH4W86kJ.
To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.

Fabrizio Starred

unread,
Apr 3, 2012, 4:25:07 AM4/3/12
to google...@googlegroups.com
I have already looked for mybatis guice here but I can't understand where to place the example code written there.

I guess the last section MyBatis XML Bootstrap is good for me as well as MyBatis Bootstrap, 
but with only these pieces of code I can't set up a configuration for a web app.
Thus SqlSessionFactoryProvider  is not mentioned either in the manual reference guice

Il giorno martedì 3 aprile 2012 09:18:35 UTC+2, Joshnet ha scritto:
Why not use mybatis-guice project.  There is a detailed user guide on how to use.

Regards.
Josh.

On Tue, Apr 3, 2012 at 1:04 AM, Fabrizio Starred <zen...@gmail.com> wrote:
I was searching for a smart example of dependancy injection of the SqlSessionFactory, as the mybatis manual suggested.

I have already gave a look of other examples on the site, but none show me the simple stuff I need, also because I would not inject the mappers too.

Anyone can help me ?

--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/uznbuH4W86kJ.
To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice+unsubscribe@googlegroups.com.
Josh.

To unsubscribe from this group, send email to google-guice+unsubscribe@googlegroups.com.
Josh.

To unsubscribe from this group, send email to google-guice+unsubscribe@googlegroups.com.
Josh.

To unsubscribe from this group, send email to google-guice+unsubscribe@googlegroups.com.

Fabrizio Starred

unread,
Apr 3, 2012, 5:04:34 AM4/3/12
to google...@googlegroups.com
I have already looked for mybatis guice here but I can't understand where to place the example code written there.

I guess the last section MyBatis XML Bootstrap is good for me as well as MyBatis Bootstrap, 
but with only these pieces of code I can't set up a configuration for a web app.

Josh Kamau

unread,
Apr 3, 2012, 9:55:26 AM4/3/12
to google...@googlegroups.com
Do this ;

Create mybatis-config.xml file and name it as such.
Create your mappers xml files 

Now if you are using guice, you already know about modules. MybatisGuice gives you another module  thats instantiated as 
  Module module = new XMLMybatisModule(){
             //set environment id
    }

Then use the module among your other modules.

Regards.
Josh.

To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/aJLUfPnzzYMJ.

To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice...@googlegroups.com.

Fabrizio Starred

unread,
Apr 3, 2012, 10:40:00 AM4/3/12
to google...@googlegroups.com


Il giorno martedì 3 aprile 2012 00:04:30 UTC+2, Fabrizio Starred ha scritto:
Reply all
Reply to author
Forward
0 new messages