Possbily Related errors related to JPA Mapping: Duplicate entity found in the persistence unit

11 Views Asked by At

I've inherited this project and it's data model. It seems to have 2 classes called Login that it wants to persist: ... / .model.Login ../ .security.model.Login

Then, in the security.model.Login class, I have the following annotations:

@NamedQueries({
@NamedQuery(
        name="loginByUsername",
        query="SELECT l FROM Login l" +
                " WHERE UPPER(l.username) = :username",
        hints={
            @QueryHint(name=QueryHints.REFRESH, value=HintValues.TRUE)
        }
),
@NamedQuery(
        name="loginByUserId",
        query="SELECT l FROM Login l" +
                " WHERE l.userid = :userId",
        hints={
            @QueryHint(name=QueryHints.REFRESH, value=HintValues.TRUE)
        }
)

})

I'm getting the following 3 errors in the problems tab of Eclipse:

Login.java The state field path 'l.userid' cannot be resolved to a valid type. /mds_web_app_java/src/gov/va/aitc/mds/security/model line 37 JPA Problem

Login.java Duplicate entity name "Login" found in the persistence unit. Entity names must be unique. /mds_web_app_java/src/gov/va/aitc/mds/model line 20 JPA Problem

Login.java Duplicate entity name "Login" found in the persistence unit. Entity names must be unique. /mds_web_app_java/src/gov/va/aitc/mds/security/model line 21 JPA Problem

I suspect the problem with the duplicate entities is also affecting the interpreation of the annotations. Renaming one of the classes might require a great deal of refactoring so I'm reluctant to do that. Is there a simpler way of managing 2 persistence entities with the same class name?

0

There are 0 best solutions below