Search code examples
javajakarta-eejpa-2.0java-ee-6openjpa

OpenJPA - How to map View to Entity


I'm using WAS 8.0.0.5, which means I'm using OpenJPA 2.1.2-SNAPSHOT. I'm using the Criteria Query API and Canonical Metamodels. I need to access an Oracle View. The View has 1 column named GUID, which uses this SQL:

select sys_guid() from dual;

to populate itself.

I'm using RAD 8.5.1 and its JPA features to generate my entities based off what's in the db.

Here's my entity:

@Entity(name="vguid")
@Table(name="V_GUID")
public class VGuid implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Column(length=32)
    private String guid;

    public VGuid() {}

    public String getGuid() {
        return guid;
    }

    public void setGuid(String guid) {
        this.guid = guid;
    }
}

RAD is underlining @Column and providing this error: Column "guid" cannot be resolved on table "V_GUID"

ಠ_ಠ

I know that @Column(length=32) works because I use it works within another Entity that reads a GUID from an Oracle table (The View is used to populate the GUID field of this other table).

How can I resolve this error?


Solution

  • O.K....so, I closed RAD and reopened the project. The error disappeared. Arghhh!