Guest User

Untitled

a guest
Jun 29th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. <?xml version='1.0' encoding='utf-8'?>
  2. <!DOCTYPE hibernate-configuration PUBLIC
  3. "-//Hibernate/Hibernate Configuration DTD//EN"
  4. "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
  5. <hibernate-configuration>
  6. <session-factory>
  7. <property name="connection.url">jdbc:postgresql://localhost:5432/esea</property>
  8. <property name="connection.driver_class">org.postgresql.Driver</property>
  9. <mapping class="ais.TesttableEntity"/>
  10. <mapping resource="ais/TesttableEntity.hbm.xml"/>
  11. <!-- <property name="connection.username"/> -->
  12. <!-- <property name="connection.password"/> -->
  13.  
  14. <!-- DB schema will be updated if needed -->
  15. <!-- <property name="hbm2ddl.auto">update</property> -->
  16. </session-factory>
  17. </hibernate-configuration>
  18.  
  19. public static void main(final String[] args) throws Exception {
  20. final Session session = getSession();
  21. try {
  22. System.out.println("querying all the managed entities...");
  23. final Metamodel metamodel = session.getSessionFactory().getMetamodel();
  24. for (EntityType<?> entityType : metamodel.getEntities()) {
  25. final String entityName = entityType.getName();
  26. final Query query = session.createQuery("from " + entityName);
  27. System.out.println("executing: " + query.getQueryString());
  28. for (Object o : query.list()) {
  29. System.out.println(" " + o);
  30. }
  31. }
  32. } finally {
  33. session.close();
  34. }
  35.  
  36. Exception in thread "main" java.lang.ExceptionInInitializerError
  37. at Main.<clinit>(Main.java:22)
  38. Caused by: org.hibernate.boot.InvalidMappingException: Could not parse mapping document: ais/TesttableEntity.hbm.xml (RESOURCE)
  39. at org.hibernate.boot.jaxb.internal.InputStreamXmlSource.doBind(InputStreamXmlSource.java:46)
  40. at org.hibernate.boot.jaxb.internal.UrlXmlSource.doBind(UrlXmlSource.java:36)
  41. at org.hibernate.boot.spi.XmlMappingBinderAccess.bind(XmlMappingBinderAccess.java:59)
  42. at org.hibernate.boot.MetadataSources.addResource(MetadataSources.java:274)
  43. at org.hibernate.boot.cfgxml.spi.MappingReference.apply(MappingReference.java:70)
  44. at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:413)
  45. at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
  46. at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:691)
  47. at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
  48. at Main.<clinit>(Main.java:20)
  49. Caused by: org.hibernate.boot.MappingException: Unable to perform unmarshalling at line number 8 and column 46. Message: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.hibernate.org/xsd/orm/hbm":property}'. One of '{"http://www.hibernate.org/xsd/orm/hbm":meta, "http://www.hibernate.org/xsd/orm/hbm":tuplizer, "http://www.hibernate.org/xsd/orm/hbm":subselect, "http://www.hibernate.org/xsd/orm/hbm":cache, "http://www.hibernate.org/xsd/orm/hbm":natural-id-cache, "http://www.hibernate.org/xsd/orm/hbm":synchronize, "http://www.hibernate.org/xsd/orm/hbm":comment, "http://www.hibernate.org/xsd/orm/hbm":id, "http://www.hibernate.org/xsd/orm/hbm":composite-id}' is expected. : origin(ais/TesttableEntity.hbm.xml)
  50. at org.hibernate.boot.jaxb.internal.AbstractBinder.jaxb(AbstractBinder.java:177)
  51. at org.hibernate.boot.jaxb.internal.MappingBinder.doBind(MappingBinder.java:61)
  52. at org.hibernate.boot.jaxb.internal.AbstractBinder.doBind(AbstractBinder.java:102)
  53. at org.hibernate.boot.jaxb.internal.AbstractBinder.bind(AbstractBinder.java:57)
  54. at org.hibernate.boot.jaxb.internal.InputStreamXmlSource.doBind(InputStreamXmlSource.java:43)
  55. ... 9 more
Add Comment
Please, Sign In to add comment