Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
I'm just following the reference manuals... My problem is after executing the eventmanager class igot the error... i cannot get the sql statements as given in the manual... I'm using MySQL database..
Hibernate version:
hibernate 3.1
Mapping documents:
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="show_sql">true</property>
<mapping resource="events/Events.hbm.xml"/>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="connection.url">
jdbc:mysql://192.9.200.63:3306/test
</property>
<property name="connection.username">
root
</property>
<property name="connection.password">
</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
</session-factory>
</hibernate-configuration>
Code between sessionFactory.openSession() and session.close():
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
Events theEvent = new Events();
theEvent.setTitle(title);
theEvent.setDate(theDate);
session.save(theEvent);
session.getTransaction().commit();
Full stack trace of any exception that occurs:
[java] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
[java] log4j:WARN Please initialize the log4j system properly.
[java] Initial SessionFactory Creation failed...org.hibernate.MappingException: invalid configuration
[java] Exception in thread "main" java.lang.ExceptionInInitializerError
[java] at util.HibernateUtil.<clinit>(Unknown Source)
[java] at events.EventManager.CreateAndStoreEvent(Unknown Source)
[java] at events.EventManager.main(Unknown Source)
[java] Caused by: org.hibernate.MappingException: invalid configuration
[java] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1347)
[java] at org.hibernate.cfg.Configuration.configure(Configuration.java:1288)
[java] at org.hibernate.cfg.Configuration.configure(Configuration.java:1274)
[java] ... 3 more
[java] Caused by: org.xml.sax.SAXParseException: The content of element type "session-factory" must match "(property*,mapping*,(class-cache|collection-cache)*,event*,listener*)".
[java] at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
[java] at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
[java] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
[java] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
[java] at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2048)
[java] at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:932)
[java] at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
[java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
[java] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
[java] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
[java] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
[java] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
[java] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
[java] at org.dom4j.io.SAXReader.read(SAXReader.java:465)
[java] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1344)
[java] ... 5 more
[java] Java Result: 1
Name and version of the database you are using:
mysql5.0.11 beta
The generated SQL (show_sql=true):
No sql statements are generated
Debug level Hibernate log excerpt:
How to get the hibernate log excerpt? i have no idea on that???