The best thing you can do is to download the tapestry source and look at the hibernate integration. The best places to start are HibernateCoreModule and Hibernate module.
In my opinion, there are three core things that tapestry-hibernate does that I think your module should do: 1. It provides a hibernate Session which has a scope of ScopeConstants.PERTHREAD. This hibernate session is lazily created the first time a thread needs a Session. All further hibernate calls on the thread share the same session which is important for transactions. 2. It contributes to the ValueEncoderSource for every hibernate entity. This means that it can automatically serialize/deserialize entites from strings. This means that a primary key in a URL (activation request parameter or event parameter) will automatically translate to an entity looked up from the database with no boilerplate required. In tapestry-hibernate, entity classes are placed in the "basepackage.entities" package. 3. It supports the @CommitAfter annotation by contributing a ComponentClassTransformWorker2. So, in mybatis I think options 1,2 & 3 will be done as follows: 1. Define a SqlSession service in your MybatisModule with scope of ScopeConstants.PERTHREAD. This can be done via a PropertyShadowBuilder which lazily calls openSession() on a SqlSessionFactory singleton. 2. This will be the most difficult part. For each entity, you will need to know - Entity class - Field(s) which make up the primary key - DAO to invoke a method on - DAO method to invoke (eg findPyPrimaryKey) Not sure if mybatis has all of this information or if you might need your own custom annotations. You might choose to provide a service that users can contribute their own config to. 3. This shouldn't be too hard to copy from tapestry-hibernate. If you could somehow do all of this without requiring a single mybatis XML file, that would be great. Not sure if that's possible. Good luck, I look forward to seeing your module in action. I'm a big fan of mybatis for it's hands-on approach to sql. Cheers, Lance. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Contribution-Tapestry-Mybatis-plugin-tp5719059p5719060.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org