Entity « Annotation « JPA Q&A





1. Hibernate/JPA Annotations -- Unknown Entity    stackoverflow.com

An application that has been working well for months has stopped picking up the JPA @Entity annotations that have been a part of it for months. As my integration tests ...

2. Using an Entity (and their Primary Key) as another Entity's Id    stackoverflow.com

So, I'm not sure how to ask this question, as it seems like it should be pretty easy to find the answer to this one. I have 3 tables; ContentHeader, ContentType1 ...

3. How I can disable the second-level cache of some certain entities in Hibernate without changing annotations    stackoverflow.com

I'm using Hibernate second level cache in my application, for certain business reason I can't change the entity annotation any more. In my project, apart from changing the Database from Hibernate, there ...

4. Hibernate entity with restriction    stackoverflow.com

We have a DB table that is mapped into a hibernate entity. So far everything goes well... However what we want is to only map enentitys that satisty a specific criteria, like ...

5. Hibernate Annotation for Entity existing in more than 1 catalog    stackoverflow.com

I have a Person entity mapped by Hibernate to a database table in a database catalog "Active". After a period of time, records in this database table in the "Active" ...

6. Hibernate: How to generate Id from entity constructor parameters?    stackoverflow.com

How to generate id for entity using constructor parameters - is that possible ? I need that to make tree structure (category -> subcategories...) passing to constructor parent category id.

Category category ...

7. JPA annotations and SQL tables    stackoverflow.com

I just have quick Question. If I had an sql script like this:

create table person(
    phoneNumber int
    name varchar(100) not null
    primary ...

8. How do I get Checkstyle to ignore final method rule on classes marked with the @Entity annotation?    stackoverflow.com

Say I have classes marked with the @Entity annotation

@Entity
class User {

   public String getName(String name) {
      return this.name;
   }

}
Checkstyle will report that ...

9. multiple @id annotaions in a single entity    stackoverflow.com

what is the difference between usgin multiple @Id in an entity Vs, Composite Id ? also how does this @EmbeddedId works when there is no table actually created for the separately for ...





10. What's the difference between the name argument in @Entity and @Table when using JPA?    stackoverflow.com

I'm using JPA2 and both @Entity and @Table have a name attribute, e. g.:

@Entity(name="Foo")
@Table (name="Bar")
class Baz
What should I use, which ones are optional? In my specific case I have a class ...

11. Why jpa and hibernate both have "Entity" and "Table" annotations?    stackoverflow.com

I use hibernate 3.6, and found there are such annotations:

javax.persistence.Entity
org.hibernate.annotations.Entity

javax.persistence.Table
org.hibernate.annotations.Table
Why hibernate provides its own? Is it a replacement of jpa one, or just a complement? Should(Can) I use them both together, ...

12. Annotations on instance declaration or get method using JPA in entities?    coderanch.com

Hi, I first thought it was neat to have the JPA annotations on the instance variable declarations in my entities. That way they're all neatly together and are easy to get an overview of at the beginning of my class definitions. Then I heard that the recommended way is to have the JPA annotations on the get-methods related to the instance ...

15. Dynamic Entity with Annotations    forum.hibernate.org

@Entity @DiscriminatorValue(value="user") @Table(name="TBLUSER") //tblUsers public class RAPIDUser implements User { ..... @Override @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id", updatable=false, nullable = false) public Long getId() { } ...

16. Several Any Annotation in a Entity    forum.hibernate.org

Hello, I have one problem with the Any annotation. I have more than one properties in my mapping that depends on the same column/property (in this case TYPE_SETTING). @Any(metaColumn = @Column(name="TYPE_SETTING",unique=false,updatable=false,insertable=false)) @AnyMetaDef(idType = "int", metaType = "string", metaValues = { @MetaValue(targetEntity = eu.sanco.rasff.model.setting.Company.class, value = TypeSettingEnum.COMPANY_STRING) , @MetaValue(targetEntity = eu.sanco.rasff.model.setting.Laboratory.class, value = TypeSettingEnum.LABORATORY_STRING) ) } ) @JoinColumn(name="CURRENT_SETTING",nullable=false,updatable=true,insertable=true) @Cascade(value = { CascadeType.ALL ...





17. Filter behavior on annotated entity    forum.hibernate.org

Hello, We have a Filter setup on an entity using the "FilterDef" and "Filters" annotations. This works as we would expect with Criteria and HQL as long as the entity with the Filter is the "from" entity of the query. However, when the entity with the Filter is joined to from some other entity in the query, the Filter doesn't kick ...

18. Enforce Hibernate / JPA to re-scan entity annotations?    forum.hibernate.org

Hi everyone, we are usig Hibernate as persistence provider under JBoss AS 5.1.0 and also in Java SE deployments. In both scenarios Hibernate scans the entity class definitions for annotations during an early initialization phase and stores the information about the entities (ORM) for the lifetime of the process. I would be interested in a way to force Hibernate to re-read ...

19. Hibernate Annotations: unknown entity    forum.hibernate.org

Newbie Joined: Sun Jan 22, 2006 3:27 pm Posts: 11 Hibernate version:3.1 Name and version of the database you are using: hdsql Hi I know that this exception looks innocuos and a beginner's error but I cannot for the life of me get past it. I have got Hibernate to work perfectly with externally mapped properties in an xml file per ...

20. Annotations for entity names    forum.hibernate.org

21. Using (annotated) entity classes outside a container?    forum.hibernate.org

Hello! I have got a general question concerning Hibernate: I have got annotated entity classes represeting a database schema. Now I would like to use these entity classes in order to communicate with a database via Hibernate from OUTSIDE an application container. Is this possible? If yes, please let me know how. The reason behind is that the project I am ...

22. Vererbung, Annotations -> Unknown entity    forum.hibernate.org

public void add() { ServiceLoader service = load(); while(service.iterator().hasNext()) { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); ...

23. Multiple Tables per Entity with Annotations ('entity-name')?    forum.hibernate.org

Hello all, this question references to Hibernate-Core 3.2.6.ga and Hibernate-Annotations 3.3.1.GA. As stated in Java Persistence with Hibernate, chapter 3.4.1 p.147 et sqq., one can map a class several times using the entity-name tag. I wonder if this somehow could be done using Hibernate-Annotations. The goal my team mates and I want to reach is the following: We're working on an ...

25. Create an entity with a namedQuery and @Basic annotations    forum.hibernate.org

@NamedNativeQuery( name= "detail", query = "SELECT * FROM DetailTable" resultSetMapping ="detailMapping") @SqlResultSetMapping(name="detailMapping", entities={@EntityResult( entityClass=VoucherItem.class,fields={@FieldResult(name="transientField",column="detailField")})}) @Entity @Table(name = "tableX") public class Detail implements Serializable() { @Basic private String persistentField @Transient ...

26. Problem to create a webservice that return entities with JPA annotations    forums.oracle.com

In my application , i need webservices that return entitites (ex: InternalOrganisation) The entity has JPA annotations. JPA annotation requires a persistence.xml The persistence.xml requires a datasource The datasource require a database Okay But the webservice client requires the entities in the jar which require a persistence.xml and a database BUT the client has NO database. That's my problem... Solution: create ...