jsf - Error org.hibernate.InstantiationException: Could not instantiate entity -



jsf - Error org.hibernate.InstantiationException: Could not instantiate entity -

i have next setup:

glassfish server 4.1 hibernate 4.3.6.final jpa 2.0

the application deployed on server, tables created , populated properly. error happens when open web application written in javaserver faces.

when seek entity i've got exception

javax.servlet.servletexception: org.hibernate.instantiationexception: not instantiate entity: : entity.test

i've got exception in next code line em.find(test.class, 1l);. next line not work too. original code created simple test case show issue.

package service; import java.io.serializable; import java.util.list; import java.util.logging.logger; import javax.faces.bean.sessionscoped; import javax.inject.named; import javax.persistence.entitymanager; import javax.persistence.persistencecontext; import entity.test; import entity.weatherinfo; @named @sessionscoped public class weatherinfoentrybean implements serializable{ @persistencecontext entitymanager em; /** * @return blogentry */ public list<weatherinfo> getentities() { em.find(test.class, 1l); list<weatherinfo> weatherinfos = em.createquery("select w weatherinfo w").getresultlist(); homecoming weatherinfos; } }

the test entity simple

package entity; import javax.persistence.*; import java.io.serializable; @entity @table(name = "test") public class test implements serializable { private long id; private string url; public test() { super(); } @id @generatedvalue(strategy = generationtype.auto) public long getid() { homecoming id; } @column(name = "url") public string geturl() { homecoming url; } public void setid(long id) { this.id = id; } public void seturl(string url) { this.url = url; } }

persistence.xml file looks normal based on jpa docs:

<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="weathertaskpersistenceunit" transaction-type="jta"> <provider>org.hibernate.jpa.hibernatepersistenceprovider</provider> <jta-data-source>jdbc/__default</jta-data-source> <class>entity.weatherinfo</class> <class>entity.cityinfo</class> <class>entity.api</class> <class>entity.test</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.sunonejtaplatform"/> <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/> <property name="javax.persistence.schema-generation.create-source" value="metadata"/> <property name="javax.persistence.sql-load-script-source" value="meta-inf/data.sql"/> <property name="hibernate.dialect" value="org.hibernate.dialect.derbydialect"/> </properties> </persistence-unit> </persistence>

is setup supposed work? doing wrong? there info missing here?

i guess problem super() phone call in constructor of test class.

this phone call doesn't create sense because extending object.

hibernate jsf jpa glassfish

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Php operator `break` doesn't stop while -