0

I'm working with Person.java.

This Hibernate Entity does not have any fields marked @Field.

Another class, Group.java is an Entity that has fields marked @Field.

@Field
private int id;

In this legacy code, I see queries for Group:

   getEntityManager().createQuery("delete from group g where g.id = 
:inputId").setParameter("inputId", givenId).getSingleResult();

However, I'm not sure how to make a Hibernate query for an Entity that has no fields.

Thanks, Kevin

2
  • does Person entity have any fields with @id ? Commented Nov 20, 2012 at 22:03
  • I was just being dumb. It turns out my Person had a field of type 'x.' I then made my query with "delete from person p where p.x.id = ..." Commented Nov 20, 2012 at 22:07

1 Answer 1

2

@Field is not a JPA annotation, and is not a Hibernate annotatiion either. I don't know from which package it comes from, but it doesn't have anything to do with JPA/Hibernate persistence. So, regarding Hibernate queries, the fact that a field has this annotation or not is irrelevant.

By default, without any annotation, all the fields of a JPA entity are persistent.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.