摘要:
一.Annotation方式beans.xml中的配置如下: <tx:annotation-driven transaction-manager="txManager"/> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /& 阅读全文
摘要:
package com.chenhuan.test;import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;import java.sql.Statement;public class jdbcTransaction { public static String url = "jdbc:mysql://localhost/pro?Unicode=true&characterEncoding=gb2312"; public static String d 阅读全文
摘要:
@说明: 利用db的metadata可以获取数据库表的结构,从而利用xml生成技术生成hibernate文件。 package com.chenhuan.test; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.ResultSet; public class metaData { public static String url... 阅读全文
摘要:
import java.io.FileWriter;import org.dom4j.Document;import org.dom4j.DocumentHelper;import org.dom4j.Element;import org.dom4j.io.OutputFormat;import org.dom4j.io.XMLWriter;public class createXML { public static void main(String args[]) throws Exception{ Document doc = DocumentHelper.c... 阅读全文
摘要:
import java.io.File;import java.util.List;import org.dom4j.Document;import org.dom4j.Node;import org.dom4j.io.SAXReader;public class XmlXPath { public static void main(String args[]) throws Exception{ SAXReader reader = new SAXReader(); Document doc = reader.read(new File("che... 阅读全文
摘要:
import java.io.File;import java.util.Iterator;import org.dom4j.Attribute;import org.dom4j.Document;import org.dom4j.DocumentException;import org.dom4j.Element;import org.dom4j.Node;import org.dom4j.io.SAXReader;public class XMLDom4j { public static void main(String args[]){ /* * 读取xml的流 ... 阅读全文