Guest User

Untitled

a guest
Jul 28th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.17 KB | None | 0 0
  1. Jul 28, 2018 3:03:26 PM org.hibernate.Version logVersion
  2. INFO: HHH000412: Hibernate Core {5.2.17.Final}
  3. Jul 28, 2018 3:03:26 PM org.hibernate.cfg.Environment <clinit>
  4. INFO: HHH000206: hibernate.properties not found
  5. Initial SessionFactory creation failed.org.hibernate.internal.util.config.ConfigurationException: Unable to perform unmarshalling at line number 1 and column 87 in RESOURCE hibernate.cfg.xml. Message: cvc-elt.1: Cannot find the declaration of element 'hibernate-configuration'.
  6. Exception in thread "main" java.lang.ExceptionInInitializerError
  7. at util.HibernateUtil.<clinit>(HibernateUtil.java:13)
  8. at DAO.DataDAO.add(DataDAO.java:10)
  9. at Test.main(Test.java:20)
  10. Caused by: org.hibernate.internal.util.config.ConfigurationException: Unable to perform unmarshalling at line number 1 and column 87 in RESOURCE hibernate.cfg.xml. Message: cvc-elt.1: Cannot find the declaration of element 'hibernate-configuration'.
  11. at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:133)
  12. at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:65)
  13. at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:57)
  14. at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:163)
  15. at org.hibernate.cfg.Configuration.configure(Configuration.java:258)
  16. at org.hibernate.cfg.Configuration.configure(Configuration.java:244)
  17. at util.HibernateUtil.<clinit>(HibernateUtil.java:10)
  18. ... 2 more
  19. Caused by: javax.xml.bind.UnmarshalException
  20. - with linked exception:
  21. [org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 87; cvc-elt.1: Cannot find the declaration of element 'hibernate-configuration'.]
  22. at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:468)
  23. at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:448)
  24. at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:420)
  25. at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:126)
  26. ... 8 more
  27. Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 87; cvc-elt.1: Cannot find the declaration of element 'hibernate-configuration'.
  28. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
  29. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
  30. at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
  31. at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
  32. at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
  33. at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1901)
  34. at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741)
  35. at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:568)
  36. at com.sun.xml.internal.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startElement(ValidatingUnmarshaller.java:86)
  37. at com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:60)
  38. at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.handleStartElement(StAXEventConnector.java:246)
  39. at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.bridge(StAXEventConnector.java:115)
  40. at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:445)
  41. ... 10 more
  42.  
  43. <hibirnate-mapping>
  44. <class name="logic.Data" table="dates">
  45. <id column="ssoid" name="id" type="java.lang.String"></id>
  46.  
  47. <property column="ts" name="time" type="java.lang.Long"></property>
  48. <property column="grp" name="groupEvent" type="java.lang.String"></property>
  49. <property column="type" name="event" type="java.lang.String"></property>
  50. <property column="subtype" name="subevent" type="java.lang.String"></property>
  51. <property column="url" name="url" type="java.lang.String"></property>
  52. <property column="orgid" name="organization" type="java.lang.String"></property>
  53. <property column="formid" name="formId" type="java.lang.String"></property>
  54. <property column="code" name="code" type="java.lang.String"></property>
  55. <property column="ltpa" name="itpa" type="java.lang.String"></property>
  56. <property column="sudirresponse" name="sudirresponse" type="java.lang.String"></property>
  57. <property column="ymdh" name="date" type="java.util.Date"></property>
  58. </class>
  59. </hibirnate-mapping>
  60.  
  61. <hibernate-configuration xmlns="http://www.hibernate.org/xsd/hibernate-configuration">
  62. <session-factory>
  63. <property name="hibernate.hbm2ddl.auto">update</property>
  64. <property name="hibernate.connection.url">jdbc:postgresql://127.0.0.1:5432/test"></property>
  65. <property name="connection.driver_class">org.postgresql.Driver</property>
  66. <property name="hibernate.connection.username">test"</property>
  67. <property name="hibernate.connection.password">test</property>
  68. <!--<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQL94Dialect"</property>-->
  69.  
  70. <property name="connection.pool_size">1</property>
  71. <property name="current_session_context_class">thread</property>
  72. <property name="show_sql">true</property>
  73.  
  74. <mapping resource="logic/Data.hbm.xml"></mapping>
  75.  
  76. </session-factory>
  77. </hibernate-configuration>
  78.  
  79. <mapping resource="logic/Data.hbm.xml"></mapping>
  80.  
  81. import logic.Data;
  82. import org.hibernate.Session;
  83. import util.HibernateUtil;
  84.  
  85. public class DataDAO {
  86.  
  87. public void add(Data data){
  88. try(Session session = HibernateUtil.getSessionFactory().openSession()){
  89. session.beginTransaction();
  90. session.save(data);
  91. session.getTransaction().commit();
  92. }
  93. }
  94. }
Add Comment
Please, Sign In to add comment