自动生成Java实体类
JDBC读取数据库元数据,生成JAVA实体类
package com.nffish.util;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import com.nffish.common.DBSession;
public class GenEntityTool {
private String tablename = "petDiary";
private String[] colnames; // 列名数组
private String[] colTypes; // 列名类型数组
private int[] colSizes; // 列名大小数组
private boolean f_util = false; // 是否需要导入包java.util.*
private boolean f_sql = false; // 是否需要导入包java.sql.*
public GenEntityTool() {
Connection conn = DBSession.getConnection(); // 得到数据库连接
String strsql = "select * from " + tablename;
try {
PreparedStatement pstmt = conn.prepareStatement(strsql);
ResultSetMetaData rsmd = pstmt.getMetaData();
int size = rsmd.getColumnCount(); // 共有多少列
colnames = new String[size];
colTypes = new String[size];
colSizes = new int[size];
for (int i = 0; i < rsmd.getColumnCount(); i++) {
colnames[i] = rsmd.getColumnName(i + 1);
colTypes[i] = rsmd.getColumnTypeName(i + 1);
&n
相关文档:
由于Flex Builder compiler shell有memory leak的问题, 而SDK默认的的 JVM heap size 只有312M,当compile比较大的project容易不够,所以只要修改SDK的JVM参数就可以。
编辑 {Flex SDK}/bin/jvm.config 文件如下。
java.args=-Xmx512m ...
如果还是有Error,可以增加到1024或者更多。 ......
Java Class Attribute Type Hibernate Type Possible SQL Type-Vendor Specific
Integer, int, long short &n ......
在使用RegularExpressionValidator验证控件时的验证功能及其验证表达式介绍如下:
只能输入数字:“^[0-9]*$”
只能输入n位的数字:“^d{n}$”
只能输入至少n位数字:“^d{n,}$”
只能输入m-n位的数字:“^d{m,n}$”
只能输入零和非零开头的数字:“^(0|[1- ......
import java.util.regex.*;
public final class RegExpValidator
{
/**
* 验证邮箱
* @param 待验证的字符串
* @return 如果是符合的字符串,返回 <b>true </b>,否则为 <b>false </b>
*/
public static boolean isEmail(String str)
{ ......
package testPackage;
class Test {
public static void main(String[] args) {
String hello = "Hello", lo = "lo";
System.out.print((hello == "Hello") + " ");
System.out.print((Other.hello == hello) + " ");
System.out.print((other.Other.hello == hello) + " ");
System.out.print((hello == ("Hel"+"lo ......