users@glassfish.java.net

Re: JPA with database Views

From: <glassfish_at_javadesktop.org>
Date: Tue, 06 Nov 2007 15:30:57 PST

I have the an entity mapped to a view annotated with @Entity.

Then I have tried two approaches:
1. Leaving out the @Id
2. Mapping two properties to the same column of the view

The first one kindly noted that I need to have an Id for the entity. The second one just gave me a mapping error:

01:11:00,848 WARN [ServiceController] Problem starting service persistence.units:ear=ps.ear,jar=psEjb.jar,unitName=phone
java.lang.NullPointerException
        at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:135)
        at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
        at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:296)
        at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
        at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1233)
        at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:869)
        at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:407)
        at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:126)
        at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)
[Message sent by forum member 'macondo' (macondo)]

http://forums.java.net/jive/thread.jspa?messageID=244183