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
 
相关文档:
原帖地址:
http://coolshell.cn/?p=2235
----------------我是紫苑最萌的分割线XD--------------
概述:
本文主要研究的是JAVA的字符串拼接的性能,原文中的测试代码在功能上并不等价,导致concat的测
试意义不大。不过原作者在评论栏给了新的concat结果,如果有兴趣的同学建议自己修改代码测试。
原文出处:http://ww ......
目的:将数据批量导入远程服务器
环境:SQL软件,EXCEL软件,VS2005软件,本地两个机器上都有SQL数据库,而且数据存放在其中一个表。
操作实践
1、用远程数据库的ip、用户名、密码在本地登录;
2、结果,其中一个机器能登录,一个不能登录(以下操作在可登录的机器上完成);
3、第一次我想通 ......
public List<FirmAttachmentModel> LoadFirmAttachmentByFirmId(int FirmId, int pageIndex, int pageSize)
{
List<FirmAttachmentModel> result = new List<FirmAtt ......
SQl Xml和C# Xml数据的一点操作总结
在此申明Xml是InfoSet数据不是字符串,所以在此强烈反对用string拼接xml。数据库可以存放xml类型数据,那么该数据的具体操作又如何了。
1.首先建立一张含有xml数据类型的表
CREATE TABLE [dbo].[TestXml](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[Message] [xml] NULL ......
第一种:
select b.* from
( select a.*, rownum row_num from
(select t.* from A05_ORGANIZATION t order by org_name_en asc) a
) b
where b.row_num between 1 and 5 order by b.row_num asc
第二种(更高效):
select b.* from
( select a.*, rown ......