Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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:postgresql://localhost:5432/esea</property>
- <property name="connection.driver_class">org.postgresql.Driver</property>
- <mapping class="ais.TesttableEntity"/>
- <mapping resource="ais/TesttableEntity.hbm.xml"/>
- <!-- <property name="connection.username"/> -->
- <!-- <property name="connection.password"/> -->
- <!-- DB schema will be updated if needed -->
- <!-- <property name="hbm2ddl.auto">update</property> -->
- </session-factory>
- </hibernate-configuration>
- public static void main(final String[] args) throws Exception {
- final Session session = getSession();
- try {
- System.out.println("querying all the managed entities...");
- final Metamodel metamodel = session.getSessionFactory().getMetamodel();
- for (EntityType<?> entityType : metamodel.getEntities()) {
- final String entityName = entityType.getName();
- final Query query = session.createQuery("from " + entityName);
- System.out.println("executing: " + query.getQueryString());
- for (Object o : query.list()) {
- System.out.println(" " + o);
- }
- }
- } finally {
- session.close();
- }
- Exception in thread "main" java.lang.ExceptionInInitializerError
- at Main.<clinit>(Main.java:22)
- Caused by: org.hibernate.boot.InvalidMappingException: Could not parse mapping document: ais/TesttableEntity.hbm.xml (RESOURCE)
- at org.hibernate.boot.jaxb.internal.InputStreamXmlSource.doBind(InputStreamXmlSource.java:46)
- at org.hibernate.boot.jaxb.internal.UrlXmlSource.doBind(UrlXmlSource.java:36)
- at org.hibernate.boot.spi.XmlMappingBinderAccess.bind(XmlMappingBinderAccess.java:59)
- at org.hibernate.boot.MetadataSources.addResource(MetadataSources.java:274)
- at org.hibernate.boot.cfgxml.spi.MappingReference.apply(MappingReference.java:70)
- at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:413)
- at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
- at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:691)
- at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
- at Main.<clinit>(Main.java:20)
- 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)
- at org.hibernate.boot.jaxb.internal.AbstractBinder.jaxb(AbstractBinder.java:177)
- at org.hibernate.boot.jaxb.internal.MappingBinder.doBind(MappingBinder.java:61)
- at org.hibernate.boot.jaxb.internal.AbstractBinder.doBind(AbstractBinder.java:102)
- at org.hibernate.boot.jaxb.internal.AbstractBinder.bind(AbstractBinder.java:57)
- at org.hibernate.boot.jaxb.internal.InputStreamXmlSource.doBind(InputStreamXmlSource.java:43)
- ... 9 more
Add Comment
Please, Sign In to add comment