Kevin Meredith
Kevin Meredith

Reputation: 41909

Hibernate Query on Entity Class

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

Upvotes: 0

Views: 484

Answers (1)

JB Nizet
JB Nizet

Reputation: 691635

@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.

Upvotes: 2

Related Questions