Directory (?) [+] Overview
JBoss Series 56: The JBoss 7/wildfly cluster Java persistence API (JPA)-I discusses the basic JPA-related theories of jboss clustering, and the JPA implementation of JBoss is hibernate, So the JBoss cluster JPA is mainly hibernate cluster, in the basic theory we describe the hibernate cache (query cache) and level two cache, this article gives a hibernate cache (
Program development Sometimes there are a number of special database tables, this time a binding T data column is more troublesome, you can query the database column name, directly output, you can output columns, add different content output /*** This method separates the table names according to the result set of the query, so they are displayed sequentially *@paramtableName database table name *@author
*-------------------------------------------------------------------- ---------------* 2014-5-25 GX 1.0 1.0 * Why What is modified: 4, after writing a good class content, in the construction project to join the Auxiliary JUnit test package Junit.jar, but also to import the database connection Mysq-connector-java-5.1.7-bin.jar Sqljdbc.jar, So that you can connect to the database; 5, all the work done, you can start the service to run the view result
V. Query data stored procedures (fuzzy query)
-----------------存储过程--------------------- create procedure FindCusts @cust varchar(10) as select customerid from orders where customerid like '%'+@cust+'%' ---------------执行--------------------------- execute FindCusts 'alfki' -------------在JAVA中调用-------------------------- import java.sql.*; public class Procedure
();Out.close ();The following is a JSON data string that organizes the data queried from the database into the format that the foreground needs.StringBuffer json = new StringBuffer ();String jsondata = "";......Here to use the parameters from the front desk for database paging queryint startnum = new Integer (start). Intvalue ();int limitnum = new Integer (limit). Intvalue ();Startnum = Startnum + 1;Limitnum = Startnum + limitnum;......rs = Ps.executequery ();The count here is the name of the t
=statement.executeupdate (command); System.out.println (Number of affected rows: +count); String Selectsql= "SELECT * FROM A_dept"; Try(ResultSet ResultSet =statement.executequery (Selectsql)) {
while(Resultset.next ()) {System.out.println (Resultset.getint ("id")); System.out.println (Resultset.getstring ("Name")); }
}
}
}
} The above code uses two usages of try, and it is recommended to use the second usage when you need to release
*------------------------------------------------------------------------------- ----* 2014-5-25 GX 1.0 1.0 * Why What is modified: 4, after writing a good class content, in the construction project to join the Auxiliary JUnit test package Junit.jar, but also to import the database connection Mysq-connector-java-5.1.7-bin.jar Sqljdbc.jar, So that you can connect to the database;5, all the work done, you can start the service to run the view results,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.