ObjectDB ObjectDB

createQuery method error

#1

Hello,

I am learning ObjectDB now. I create a simple Dao method as below:

 

public boolean isJobExist(String name) {
    TypedQuery<Long> query = em.createQuery(
        "SELECT count(j) FROM MFJob j WHERE j.jobName = :name", Long.class);
    return query.setParameter("name", name).getSingleResult()>0 ? true : false;
}

Once I compile it, Error:

C:\Users\xxx\xxxxx\vobs\xxxxx\xxxxx\src\main\java\com\xxxx\ xxxx \xxxx\dao\JobDao.java:75: createQuery(java.lang.String) in javax.persistence.EntityManager cannot be applied to (java.lang.String,java.lang.Class<java.lang.Long>)
    [javac]       TypedQuery<Long> query = em.createQuery(

-----------------------------------

Sounds like I am using jpa 1.0 implement, but I do have objectdb.jar in my classpath. can anybody help?

thanks

 

edit
delete
#2

Maybe you have an old JPA or ObjectDB JAR in your classpath before the new objectdb.jar file.

What version of ObjectDB are you using?

 

ObjectDB Support
edit
delete
#3

Thanks. I got it. 

I have javaee-api-5.jar in my classpath which causes the error

edit
delete

Reply

To post on this website please sign in.