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对象转换为字节序列,即java对象序列号,才能在网络上传送;接收方则需要把字节序列再恢复为Java对象,即反序列化。
把Java对象转换为字节序列的过程称为对象的序列化。
......
一、利用jdk web服务api实现,这里使用基于 SOAP message 的 Web 服务
1.首先建立一个Web services EndPoint:
Java代码
package Hello;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.xml.ws.Endpoint;
@WebService
public class Hello {
@WebMet ......
java 连接 sql 2005 的方法:
1。到微软官方网站下载2005的jdbc并解压,获得文件sqljdbc.jar
2。复制文件sqljdbc.jar到jdk目录\jdk1.5\jre\lib\ext下。
3。开始-〉程序-〉sql server 2005-〉配置工具-〉SQL Server Configuration Manager。启动sql 2005服务。
点击 sql server2005网络配置节点,并选中&rd ......
第一种:
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 ......