Does mybatis support hot deploy?

134 views
Skip to first unread message

Kurt Xu

unread,
Sep 21, 2012, 11:26:53 AM9/21/12
to mybati...@googlegroups.com
When a web application based spring has been launched, could the modifications to sql map file be reflected immediately? I'm using mybatis 3 and jrebel plugin, modifications to classes can be reflected instantly. I guess modifications to the sql map file can be hot deployed somehow, because I did similar things to ibatis before, but for now I've not researched into mybatis source code. Does anyone know that?

Eduardo Macarron

unread,
Sep 21, 2012, 11:44:30 AM9/21/12
to mybati...@googlegroups.com
MyBatis is not able to reload files by itself and I tihnk JRebel is only able to load files for frameworks that it knows and AFAIK MyBatis is not one of them.

2012/9/21 Kurt Xu <fxb...@gmail.com>

Mike Fotiou

unread,
Sep 21, 2012, 9:13:50 PM9/21/12
to mybati...@googlegroups.com
Yes, JRebel does support Mybatis - we have been using it for a while and it does reload the mappers.  If you do roll your own configuration classes, though, the plugin will not work as it monitors certain MyBatis classes by name.

You can also roll you own reloader, but it can be dicey as all sorts of things have to be reloaded - result maps, sql fragments, caches, etc.. when a mapper changes.

Eduardo Macarron

unread,
Sep 22, 2012, 2:27:36 AM9/22/12
to mybati...@googlegroups.com
Thats good news! Thanks for the information Mike.

2012/9/22 Mike Fotiou <mof...@gmail.com>

Kurt Xu

unread,
Sep 24, 2012, 11:48:44 AM9/24/12
to mybati...@googlegroups.com
Hello , I am using JRebel but seems not to be able to reload the changes when I modify the sql fragments in the mapper.xml. I use mybats in a spring-based web environment. The configuration of applicationContext.xml is like this:
<bean id="shiroSqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="${shiro.datasource}"/>
<property name="mapperLocations" value="classpath*:com/shiroside/authorization/dao/**/*.xml"/>
</bean>

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.shiroside.authorization.dao"/>
</bean>

<bean id="shiroTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="${shiro.datasource}"/>
</bean>

 And I just define Mapper interface not concrete implement class which I guess would be implemented by mybatis itself. The mapper interface is like below:
package com.shiroside.authorization.dao;

import com.shiroside.authorization.model.Path;
import com.shiroside.authorization.model.Permission;
import com.shiroside.authorization.model.Role;
import com.shiroside.authorization.model.User;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface AuthzMapper {
List<Permission> selectAllPerms();
int selectSeq(String type);
void addSeq(String type);
List<Path> selectPathPerms();
List<Path> selectPathRoles();
void insertRole(Role role);
void insertRolePermAsso(HashMap params);
List<Role> selectAllRoles();
void deleteRole(int roleId);
void deleteRolePermAsso(int roleId);
List<User> selectAllUsers();
void deleteRoleOfUser(Map params);
void insertRole2User(Map params);
}
在 2012年9月22日星期六UTC+8上午9时13分52秒,moffit写道:

Nathan Maves

unread,
Sep 24, 2012, 4:16:21 PM9/24/12
to mybati...@googlegroups.com
according to their site http://zeroturnaround.com/software/jrebel/features/frameworks/ they only support 2.x
Reply all
Reply to author
Forward
0 new messages