添加address組件后測試students報錯,請問哪里的問題啊
報錯信息如下:
五月 09, 2016 4:42:46 下午 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.2.Final}
五月 09, 2016 4:42:46 下午 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.2.4.Final}
五月 09, 2016 4:42:46 下午 org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
五月 09, 2016 4:42:46 下午 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
五月 09, 2016 4:42:46 下午 org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
五月 09, 2016 4:42:46 下午 org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
五月 09, 2016 4:42:46 下午 org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: Students.hbm.xml
五月 09, 2016 4:42:46 下午 org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
五月 09, 2016 4:42:46 下午 org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: null
五月 09, 2016 4:42:47 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
五月 09, 2016 4:42:47 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000115: Hibernate connection pool size: 20
五月 09, 2016 4:42:47 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000006: Autocommit mode: false
五月 09, 2016 4:42:47 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000401: using driver [oracle.jdbc.driver.OracleDriver] at URL [jdbc:oracle:thin:@172.17.11.60:1521:HDQTLS]
五月 09, 2016 4:42:47 下午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=dbusrmkt, password=****}
五月 09, 2016 4:42:47 下午 org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
五月 09, 2016 4:42:47 下午 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
Students.hbm.xml如下:
<?xml?version="1.0"?> <!DOCTYPE?hibernate-mapping?PUBLIC?"-//Hibernate/Hibernate?Mapping?DTD?3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!--?Generated?2016-5-9?15:00:28?by?Hibernate?Tools?3.5.0.Final?--> <hibernate-mapping> ????<class?name="Students"?table="STUDENTS"> ????????<id?name="sid"?type="int"> ????????????<column?name="SID"?/> ????????????<generator?class="assigned"?/> ????????</id> ????????<property?name="sname"?type="java.lang.String"> ????????????<column?name="SNAME"?/> ????????</property> ????????<property?name="gender"?type="java.lang.String"> ????????????<column?name="GENDER"?/> ????????</property> ????????<property?name="birthday"?type="date"> ????????????<column?name="BIRTHDAY"?/> ????????</property> ????????<!--?? ????????<property?name="address"?type="java.lang.String"> ????????????<column?name="ADDRESS"?/> ????????</property> ????????-->???????? ????????<component?name="address"?class="Address"> ?????????<property?name?="postcode"?column="POSTCODE"/> ?????????<property?name?="phone"?column="PHONE"/> ?????????<property?name="address"?column="ADDRESS"/> ????????</component> ???????? ????</class> </hibernate-mapping>
Students類如下:
import?java.util.Date; public?class?Students?{ private?int?sid; private?String?sname; private?String?gender; private?Date?birthday; //private?String?address; private?Address?address; public?Students(){ } ???? ?? public?Address?getAddress()?{ return?address; } public?void?setAddress(Address?address)?{ this.address?=?address; } public?int?getSid()?{ return?sid; } public?void?setSid(int?sid)?{ this.sid?=?sid; } public?String?getSname()?{ return?sname; } public?void?setSname(String?sname)?{ this.sname?=?sname; } public?String?getGender()?{ return?gender; } public?void?setGender(String?gender)?{ this.gender?=?gender; } /* public?String?getAddress()?{ return?address; } public?void?setAddress(String?address)?{ this.address?=?address; } */ public?Date?getBirthday()?{ return?birthday; } public?void?setBirthday(Date?birthday)?{ this.birthday?=?birthday; } public?Students(int?sid,?String?sname,?String?gender,?Date?birthday,?Address?address)?{ //super(); this.sid?=?sid; this.sname?=?sname; this.gender?=?gender; this.birthday?=?birthday; this.address?=?address; } @Override public?String?toString()?{ //?TODO?Auto-generated?method?stub return?"Students?[sid="?+?sid?+",sname="+?sname?+?",?gender=" +?gender+",birthday?=?"+?birthday?+?",address?="?+?address?+"]"; } }
hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
? ? <session-factory>
? ? ?<property name="connection.username">dbusrmkt</property>
? ? ?<property name="connection.password">futuremkt</property>
? ? ?<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
? ? ?<property name="connection.url">jdbc:oracle:thin:@172.17.11.60:1521:HDQTLS</property>
? ? ?<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
? ? ?
? ? ?<property name="show_sql">true</property>
? ? ?<property name="format_sql">true</property>
? ? ?<property name="hbm2ddl.auto">create</property>
? ? ?<property name="hibernate.default_schema">dbusrmkt</property>
? ? ?
? ? ?<mapping resource="Students.hbm.xml"/>
? ? ?
? ? </session-factory>
</hibernate-configuration>
2016-05-12
hibernate.properties not found