Giter Site home page Giter Site logo

Comments (5)

hellokaton avatar hellokaton commented on August 17, 2024

@cotide 你的实体中是否有定义 value 这个字段?

from anima.

cotide avatar cotide commented on August 17, 2024

我使用实体进行查询能正常工作

实体

@Table(name = "user_info")
@Data
 public class UserInfo extends Model{

 @Column(name = "user_id")
 private int userId;

 @Column(name = "`value`")
  private String value;
}

测试代码

@Test
public void query(){ 
        Anima.open(url,user,pass); 
        UserInfo result   = select().from(UserInfo.class).where(UserInfo::getUserId,1).one();
        System.out.println(result.getUserId());
        System.out.println(result.getValue());
}

输出结果

09:48:40.244 [main] DEBUG org.sql2o.Query - Execute SQL => SELECT * FROM user_info WHERE user_id = ? LIMIT 1
09:48:40.247 [main] DEBUG org.sql2o.Query - Parameters  => [1]
09:48:40.273 [main] DEBUG org.sql2o.Query - Total       => 29 ms, execution: 18 ms, reading and parsing: 11 ms; executed [null]
1
hello world

能正确输出~

使用bySQL查询user_id字段值

@Test
public void query(){ 
        Anima.open(url,user,pass);
        int value =  select().bySQL(
                Integer.class,"select `user_id` from user_info where user_id = 1").one();
        System.out.println(value);
}

能正确输出内容

image

使用bySQL查询value字段值

 @Test
 public void query(){ 
        Anima.open(url,user,pass);
       String value =  select().bySQL(
                String.class,"select `value` from user_info where user_id = 1").one();
        System.out.println(value);
}

输出内容为空~
image

from anima.

cotide avatar cotide commented on August 17, 2024

使用bySQL 查询返回对象为String.class并且针对value字段时候不能正常工作

from anima.

hellokaton avatar hellokaton commented on August 17, 2024

这个问题已经修复了,在 6bedcc0 ,你可以继续使用快照版本尝试。

mvn clean compile -U

记得更新一下最新依赖

from anima.

cotide avatar cotide commented on August 17, 2024

OK~ 获取最新代码,问题已经解决了~

from anima.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.