易截截图软件、单文件、免安装、纯绿色、仅160KB

java Annotation 拼装SQL语句

声明字段映射
@Target(ElementType.FIELD)  
@Retention(RetentionPolicy.RUNTIME) 
public @interface FiledRef
{
    String fieldName();
}
声明表映射
@Target(ElementType.TYPE)  
@Retention(RetentionPolicy.RUNTIME)
public @interface TableRef
{
    String tableName();
}
测试类
@TableRef(tableName = "MobDevice")
public class ReflectTest
{
    @FiledRef(fieldName = "ID")
    private Long id;
    @FiledRef(fieldName = "DEVICE_NAME")
    private String name;
    @FiledRef(fieldName = "DEVICE_CODE")
    private String code;
    public ReflectTest(Long id, String name, String code)
    {
        this.id = id;
        this.name = name;
        this.code = code;
    }
    public Long getId()
    {
        return id;
    }
    public void setId(Long id)
    {
        this.id = id;
    }
    public String getName()
    {
        return name;
    }
    public void setName(String name)
    {
        this.name = name;
    }
    public String getCode()
    {
        return code;
    }
    public void setCode(String code)
    {
        this.code = code;
    }
    /**
     * @description
     * @author zhangml
 


相关文档:

Java中集合容器类List和Set的用法

List的用法
List包括List接口以及List接口的所有实现类。因为List接口实现了Collection接口,所以List接口拥有Collection接口提供的所有常用方法,又因为List是列表类型,所以List接口还提供了一些适合于自身的常用方法,如表1所示。
表1  List接口定义的常用方法及功能
从表1可以看出,List接口提供的适合于自身的 ......

获取SQL Server 端口号和IP地址

在平时的工作过程中,作为DBA角色管理数据库,头脑中的印象往往是数据库实例名称,而不会去关心Server的IP,而作为Developer的角色,他们往往想知道知道Server Ip和端口号。所以,DBA会经常被问及到:XXX实例的IP和端口号是什么?
这个问题,当然我们可以Login到OS查看IP、使用配制管理工具获取到端口号。但是,这个方法非 ......

Sql helper使用方法

    public List<FirmAttachmentModel> LoadFirmAttachmentByFirmId(int FirmId, int pageIndex, int pageSize)
        {
            List<FirmAttachmentModel> result = new List<FirmAtt ......

数据库组件 Hxj.Data (十) (输出组件执行的sql)

前面有TX留言问分页的sql是怎么样的,看完这篇你也就知道了。 组件可以输出执行的sql,方便查看sql生成的语句是否有问题。 通过注册事件来输出sql DbSession.Default.RegisterSqlLogger(database_OnLog);
 
private string sql;
void database_OnLog(string logMsg)
{
//保存执行的DbCommand (sql语 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号