android ormlite登录注册的例子(7)
来源:未知 责任编辑:责任编辑 发表时间:2014-01-25 11:34 点击:次
public class UsersEntity implements Serializable
{
private static final long serialVersionUID = -6582623980712135028L;
@DatabaseField(generatedId=true)
private int id;
@DatabaseField
private String username;
@DatabaseField
private String password;
public UsersEntity(){}
public UsersEntity(int id, String username, String password)
{
super();
this.id = id;
this.username = username;
this.password = password;
}
public int getId()
{
return id;
}
public String getPassword()
{
return password;
}
public String getUsername()
{
return username;
}
public void setId(int id)
{
this.id = id;
}
public void setPassword(String password)
{
this.password = password;
}
public void setUsername(String username)
{
this.username = username;
}
}
再是操作数据库的类,我按照mvc的模式把操作数据库的类单独分离开了
Java代码
package com.cng.dao;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.cng.model.UsersEntity;
import com.j256.ormlite.dao.Dao;
public class UsersDao
{
public List<UsersEntity> findUser(Dao<UsersEntity, Integer> userdao,String username,String password) throws SQLException
{
Dao<UsersEntity, Integer> userDao = userdao;
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>