Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Jul 28, 2018 3:03:26 PM org.hibernate.Version logVersion
- INFO: HHH000412: Hibernate Core {5.2.17.Final}
- Jul 28, 2018 3:03:26 PM org.hibernate.cfg.Environment <clinit>
- INFO: HHH000206: hibernate.properties not found
- 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'.
- Exception in thread "main" java.lang.ExceptionInInitializerError
- at util.HibernateUtil.<clinit>(HibernateUtil.java:13)
- at DAO.DataDAO.add(DataDAO.java:10)
- at Test.main(Test.java:20)
- 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'.
- at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:133)
- at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:65)
- at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:57)
- at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:163)
- at org.hibernate.cfg.Configuration.configure(Configuration.java:258)
- at org.hibernate.cfg.Configuration.configure(Configuration.java:244)
- at util.HibernateUtil.<clinit>(HibernateUtil.java:10)
- ... 2 more
- Caused by: javax.xml.bind.UnmarshalException
- - with linked exception:
- [org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 87; cvc-elt.1: Cannot find the declaration of element 'hibernate-configuration'.]
- at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:468)
- at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:448)
- at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:420)
- at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:126)
- ... 8 more
- Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 87; cvc-elt.1: Cannot find the declaration of element 'hibernate-configuration'.
- at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
- at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
- at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
- at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
- at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
- at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1901)
- at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741)
- at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:568)
- at com.sun.xml.internal.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startElement(ValidatingUnmarshaller.java:86)
- at com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:60)
- at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.handleStartElement(StAXEventConnector.java:246)
- at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXEventConnector.bridge(StAXEventConnector.java:115)
- at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:445)
- ... 10 more
- <hibirnate-mapping>
- <class name="logic.Data" table="dates">
- <id column="ssoid" name="id" type="java.lang.String"></id>
- <property column="ts" name="time" type="java.lang.Long"></property>
- <property column="grp" name="groupEvent" type="java.lang.String"></property>
- <property column="type" name="event" type="java.lang.String"></property>
- <property column="subtype" name="subevent" type="java.lang.String"></property>
- <property column="url" name="url" type="java.lang.String"></property>
- <property column="orgid" name="organization" type="java.lang.String"></property>
- <property column="formid" name="formId" type="java.lang.String"></property>
- <property column="code" name="code" type="java.lang.String"></property>
- <property column="ltpa" name="itpa" type="java.lang.String"></property>
- <property column="sudirresponse" name="sudirresponse" type="java.lang.String"></property>
- <property column="ymdh" name="date" type="java.util.Date"></property>
- </class>
- </hibirnate-mapping>
- <hibernate-configuration xmlns="http://www.hibernate.org/xsd/hibernate-configuration">
- <session-factory>
- <property name="hibernate.hbm2ddl.auto">update</property>
- <property name="hibernate.connection.url">jdbc:postgresql://127.0.0.1:5432/test"></property>
- <property name="connection.driver_class">org.postgresql.Driver</property>
- <property name="hibernate.connection.username">test"</property>
- <property name="hibernate.connection.password">test</property>
- <!--<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQL94Dialect"</property>-->
- <property name="connection.pool_size">1</property>
- <property name="current_session_context_class">thread</property>
- <property name="show_sql">true</property>
- <mapping resource="logic/Data.hbm.xml"></mapping>
- </session-factory>
- </hibernate-configuration>
- <mapping resource="logic/Data.hbm.xml"></mapping>
- import logic.Data;
- import org.hibernate.Session;
- import util.HibernateUtil;
- public class DataDAO {
- public void add(Data data){
- try(Session session = HibernateUtil.getSessionFactory().openSession()){
- session.beginTransaction();
- session.save(data);
- session.getTransaction().commit();
- }
- }
- }
Add Comment
Please, Sign In to add comment