我的老师教我们使用Netbeans来学习Hibernate。 但我喜欢Intellij IDEA。 当我生成Presistence Mapping时,我无法生成hibernate.reveng.xml 我不知道hibernate.reveng.xml在Hibernate编程中是否必不可少(因为有时候它确实可以工作,但通常都会失败)
这是我在Stackoverflow中的第一个问题。请帮帮我。
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">jdbc:mysql://XXXX:3306/stuinfo</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.username">root</property>
<property name="connection.password">XXXX</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<mapping class="resources.DaibanAccountEntity"/>
<mapping class="resources.DaibanInformEntity"/>
<mapping class="resources.OperatelogEntity"/>
<mapping class="resources.UploadfileEntity"/>
<mapping class="resources.XueshengInfoEntity"/>
<!-- DB schema will be updated if needed -->
<!-- <property name="hbm2ddl.auto">update</property> -->
</session-factory>
</hibernate-configuration>
ERROR MESSAGE:
hql> from DaibanAccountEntity
[2016-11-26 17:13:21] org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [resources.DaibanInformEntity]
[2016-11-26 17:13:21] java.lang.ClassNotFoundException: Could not load requested class : resources.DaibanInformEntity
[2016-11-26 17:13:21] at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:217)
[2016-11-26 17:13:21] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[2016-11-26 17:13:21] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[2016-11-26 17:13:21] at java.lang.Class.forName0(Native Method)
[2016-11-26 17:13:21] at java.lang.Class.forName(Class.java:348)
[2016-11-26 17:13:21] at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:226)
[2016-11-26 17:13:21] at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.<init>(AnnotationMetadataSourceProcessorImpl.java:104)
[2016-11-26 17:13:21] at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.<init>(MetadataBuildingProcess.java:147)
[2016-11-26 17:13:21] at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:141)
[2016-11-26 17:13:21] at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
[2016-11-26 17:13:21] at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
[2016-11-26 17:13:21] at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
[2016-11-26 17:13:21] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:691)
[2016-11-26 17:13:21] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
[2016-11-26 17:13:21] at com.intellij.hibernate.console52.remote.HibernateFacadeImpl$MyRemoteConfigurationImpl.buildSessionFactory(HibernateFacadeImpl.java:36)
[2016-11-26 17:13:21] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2016-11-26 17:13:21] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[2016-11-26 17:13:21] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2016-11-26 17:13:21] at java.lang.reflect.Method.invoke(Method.java:498)
[2016-11-26 17:13:21] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
[2016-11-26 17:13:21] at sun.rmi.transport.Transport$1.run(Transport.java:200)
[2016-11-26 17:13:21] at sun.rmi.transport.Transport$1.run(Transport.java:197)
[2016-11-26 17:13:21] at java.security.AccessController.doPrivileged(Native Method)
[2016-11-26 17:13:21] at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
[2016-11-26 17:13:21] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
[2016-11-26 17:13:21] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
[2016-11-26 17:13:21] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
[2016-11-26 17:13:21] at java.security.AccessController.doPrivileged(Native Method)
[2016-11-26 17:13:21] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
[2016-11-26 17:13:21] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[2016-11-26 17:13:21] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[2016-11-26 17:13:21] at java.lang.Thread.run(Thread.java:745)