Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ibatis3 dao 模板 更具唯一属性来查询对象问题 #40

Closed
GoogleCodeExporter opened this issue Aug 11, 2015 · 1 comment
Closed

Comments

@GoogleCodeExporter
Copy link

<#list table.columns as column>
    <#if column.unique && !column.pk>
    public ${className} getBy${column.columnName}(${column.javaType} v) {
        return
(${className})getSqlSession().selectOne("${className}.getByUsername",v);
    }   
    </#if>
    </#list>

以上为模板源程序 

我觉得是不是应改为:

<#list table.columns as column>
    <#if column.unique && !column.pk>
    public ${className} getBy${column.columnName}(${column.javaType} v) {
        return
(${className})getSqlSessionTemplate().selectOne("${className}.getBy${column.colu
mnName}",v);
    }   
    </#if>
    </#list>

修改:getSqlSession()--》getSqlSessionTemplate()
      getByUsername--》getBy${column.columnName}


例如:
public UserLoginSession getByUserid(java.lang.String v) {

        //return
(UserLoginSession)getSqlSession().selectOne("UserLoginSession.getByUsername",v);
        // The method getSqlSession() is undefined for the type UserLoginSessionDao
        return
(UserLoginSession)getSqlSessionTemplate().selectOne("UserLoginSession.getByUseri
d",v);
    }

Original issue reported on code.google.com by zgw06...@gmail.com on 26 Feb 2010 at 7:44

@GoogleCodeExporter
Copy link
Author

十分感谢,已经修正

Original comment by bad...@gmail.com on 26 Feb 2010 at 1:36

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant