Hibernate在Spring配dataSource
S2SH整合 2008-09-12 15:25 阅读160 评论0
字号: 大大 中中 小小
<!-- mysql数据源的配置 -->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306:dbname?characterEncoding=gb2312"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
</bean>
<!—Sql Serverl2005数据源的配置 -->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value=" com.microso ......
package cn.vicky.reg;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class MyEclipseReg {
// ///////////////////////////////////////////////////////////
// 运行该文件 输入用户名 点击回车即可生成 MyEclipse 6.0 和 7.0 通用户注册码
// /////////////////////////////////////////////////////////
private static final String LL = "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA, penalties range up to a $500,000 fine or up to five years imprisonment for a first offense. Think about it; pay for a license, avoid prosecution, and feel better about yourself.";
public String getSerial(String userId, String licenseNum) {
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.add(1, 3);
cal.add(6, -1);
java.text.NumberFormat nf = new java.text.DecimalF ......
1.最简单的图形,一个消息框
import javax.swing.JOptionPane;
//表明程序使用javax.swing包的JOptionPane类
public class Dialog1{
public static void main(String[] args) {
// TODO Auto-generated method stub
//下句表明程序使用JOptionPane类的showMessageDialog方法1`
JOptionPane.showMessageDialog(null,"welcome to java");
}
}
2.仍然是简单的消息框,输入名字后显示欢迎消息
import javax.swing.JOptionPane;
public class NameDialog{
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String name=
JOptionPane.showInputDialog("what is your name? ");
String message=
String.format("welcome,%s,to java programming! ",name);
JOptionPane.showMessageDialog(null,me ......
Java2核心技术第七版中文版第二卷
第600页,警告处这样说:
如果将jar放入jre/lib/ext目录中,并且在它的类中有一个类需要调用系统类或者扩展类,那么就会遇到麻烦。扩展类加载器并不使用类路径。
刚读到这里十分不解,为什么用到系统类或扩展类会发生错误?并且一个类怎么可能不会用到系统类?于是,找到英文版原文如下:
You can run into grief if you drop a JAR file into the jre/lib/ext directory and one of its classes needs to load a class that is not a system or extension class. The extension class loader does not use the class path.
看到了吗? NOT
a system or extension class
我看这应该不是翻译者的笔误,至少没有认真翻译,或者根本不懂。 ......
今天碰到一个很有意思的问题,就是关于使用LinkedList作为HashMap或者Hashtable得key,但是最后发现数据并没有存进去。
首先说一下HashMap,Hashtable吧,它们都继承了Cloneable, Map, Serializable。它们两个基本上是一样的,“The HashMap
class is roughly equivalent to Hashtable
, except that it is
unsynchronized and permits nulls.”。区别就是HashMap允许“ null
values and the null
key”,同时 unsynchronized。它的性能取决于“ initial capacity
and load factor
”,具体参考官方文档。HashMap还有一个特性就是不能保证存入的元素的顺序,“HashMap does not guarantee that the order
will remain constant over time。” 对于存入到里面的key,要求“To successfully store and retrieve objects from a hashtable, the
objects used as keys must implement the hashCode
method and the equals
method. ”。更具我的测试,其实这个对于HashMap也是适用的。
这个就和我今天碰到的问题联系上了,LinkedList类里面的hashCode()函数来源于List.hashCode(),具体如下:
......
今天在http://www.51itdh.com/这个网站上找到有好多Java学习的资料,所以收集下来给大家分享下。这个网站挺多编程这方面资源的。
1.Java学习网站:
Java中文世界论坛 http://www.chinajavaworld.com/index.jspa
Java世纪网 http://www.java2000.net/
Java 中文站 http://www.java-cn.com/
Java学习室 http://www.java3z.com/cwbwebhome/
JavaEye http://www.javaeye.com/
Java学习站 http://www.learnjava.cn/
中文Java技术网 http://www.cn-java.com
JAVA和J2EE解决之道 http://www.jdon.com/
2.Java开发工具下载
JDK1.5
http://www.javaresearch.org/members/jross/jdk/jdk-1_5_0-windows-i586.exe
JDK1.6
http://www.java.net/download/jdk6/6u10/promoted/b3 ......