name « Entity « JPA Q&A





1. Fix for Hibernate error "Use of the same entity name twice"    stackoverflow.com

How you fix the following Hibernate error: What does "Use of the same entity name twice".

2. Is it illegitimate to name an JPA entity "Group"?    stackoverflow.com

I'm developing a JEE6-application, using JPA 2.0 and Hibernate 3.5.2-Final as the Provider (and MySQL 5.1.41). My Application Server is Glassfish V3.0.1. I already have a working CRUD-app with some entities and ...

3. How to get the PersistenceUnit name for a given entity class?    stackoverflow.com

I am developing a tool that handles some database entities using JPA2, with hibernate as the persistence provider. The tool is generic and uncoupled from any business logic, it takes a ...

4. JPA/Hibernate - Entity name seems to be important. If I rename to "Bob" works fine    stackoverflow.com

This one has had me stumped for several hours. It's related to my other question here: JPA/hibernate - Cannot add or update a child row: a foreign key constraint fails ...

5. Hibernate/JPA Dealing with entities with the same name in different persistence units    coderanch.com

When I looked at how they setup the databases, I didn't think it would be an issue, but apparently it is. Basically, we have schemas in multiple database that match almost exactly. For the sake of what I'm doing, all affected entities are the same in all 8 schemas. My application runs on jboss 5.1 and uses the latest hibernate on ...

6. QuerySyntaxException: entity class name obfuscation    forum.hibernate.org

Hi, I use JBoss 5.1 that uses Hibernate core 3.3.1 and EntityManager 3.4.0. I tried to use proguard to obfuscate entity class names. For example, @Entity(name="Foo") class Foo --> f @Entity(name="Bar") class Bar --> g NamedQuery: select a from Foo a, Bar b where .... org.hibernate.hql.ast.QuerySyntaxException: ??? is not mapped. From debug, the query string is correctly passed to Hibernate. where ...

7. session.update() does not use entity name parameter    forum.hibernate.org

Hi all, I have used the org.hibernate.Session.update(String entityName,Object object) method in the past and it worked like a charm. For some reason, it no longer does what I expect it to do. I have updated to hibernate 3.6 but still no success. This is what I am trying to do. I have a "Monitor" class that is mapped to 2 tables ...

8. Cannot create table with same name as entity class    forum.hibernate.org

Hi folks, I'm using Hibernate as persistence provider within JBoss Application Server 6. Within my project, I've created a class User.java which I've annotated to be an entity. Strangely, when I deploy my project, the mapped table is only created in my database when I add the @table annotation and specified a name which must be different from the entity class ...

9. Entity duplicate name    forum.hibernate.org





10. Help with 2nd level entity cache region names    forum.hibernate.org

Hi everyone, I'm running into an issue specifying custom region names for my 2nd level entity cache (not the query cache). I have an entity annotated like below: Code: package com.package; @Cache(usage = CacheConcurrencyStrategy.READ_ONLY, region = "myCustomRegion") public class MyEntity{ //Entity code goes here } Below is my hibernate session factory configuration (the memcached properties can be ignored for the purpose ...

11. using entity-name and join - is it possible?    forum.hibernate.org

For accessing a legacy database structure, I've implemented Interceptor.getEntityName() which seems to be a (dirty but acceptable) work-around for saving the same class in different tables. http://forum.hibernate.org/viewtopic.php?t=939568 However, now I was trying to use a join mapping for an object's content which is distributed between two tables (e.g. users and userdetails). Because of the entity-name defined for the mapping, the join ...

12. Working with "entity-name"    forum.hibernate.org

hi emmanuel, first thanks for the hint. I tried it also with hibernate 3.1 b2. It still doesn't work. Here is the code for deleting objects: Code: public class GenericInstrumentDaoImpl extends HibernateDaoSupport { public void save(Instrument instrument) { if (InstrumentType.BOND.equals(instrument.getInstrumentType())) { getHibernateTemplate().saveOrUpdate("BOND", instrument); } else if (InstrumentType.WARRANT.equals(instrument.getInstrumentType())) { getHibernateTemplate().saveOrUpdate("WARRANT", ...

13. HQL problem with entity-name    forum.hibernate.org

Hibernate version: 3.1 Hello, I have a single class mapped to two tables, the first one without entity-name attribute (i.e. the default is used), the second one with entity-name. When I use HQL, I cannot retrieve just instances of the default class (the one mapped without entity-name). Say the class is named X and mapped to table X, the first mapping ...

14. using entity-name and join - is it possible?    forum.hibernate.org

if ( value != null ) { Property prop = createProperty( value, propertyName, persistentClass .getEntityName(), subnode, mappings, inheritedMetas ); prop.setOptional( join.isOptional() ); ...

15. Adding thousands of entity names is killing memory    forum.hibernate.org

Hibernate version: 3.1.2 Spring 1.2 w/subclassed LocalSessionFactoryBean (to generate Entity Names from original XML mapping files) I have an application with about 30 basic Hibernate entities. Maybe about 5 of these entities have 100 - 200 columns of Doubles in them. Due to being forced to work with a horrible, legacy database, all 30 of these entities have 30 types of ...

16. Need help with entity-name    forum.hibernate.org

Hi. Is it possible to map the same class twice - once using entity-name and once leaving it blank? In other words, say I want to map class A thrice, can I leave one mapping blank and give the other two specific names? The point would be that calling session methods without an entity name would use the default (no-name) mapping. ...





18. object heirarchy & different tables using entity-name?    forum.hibernate.org

public String classToTableName(String className) { if ("B_E1".equals(className)) { return "TB1"; } else if ("B_E2".equals(className)) { return "TB2"; } else if (...) { .... ...

19. Does any tag support entity names in 3.1    forum.hibernate.org

20. Problem with entity-name and self-reference    forum.hibernate.org

Author Message volker Post subject: Problem with entity-name and self-reference Posted: Mon Oct 23, 2006 10:46 am Newbie Joined: Mon Oct 23, 2006 9:57 am Posts: 2 Hi, currently I have problem with a mapping and self-reference. My User class is mapped to two tables, so I used the entity-name feature. The first entity is for the current version, ...

21. Resolve qualified from unqualified entity name?    forum.hibernate.org

No The SessionFactory does not hold a reference on the configuration object. If you want to use the configuration object you have to hold it somewhere in your app. Although SessionFactoryImplementor has a method getImportedClassName that does the same, so you can use your SessionFactory for that but you will have to cast it to SessionFactoryImplementor to do that (it is ...

22. entity-name save problem    forum.hibernate.org

I don't know the exact answer for you. But my thought is create a base class entity and derive two classes out of it. Do not put attributes in the derived class, in your hbm map the derived classes. This will help you in scalability point of view too. Suppose if the Menu changes tomorrow u can just add those attributes ...

23. entity-name supported in JPA API ?    forum.hibernate.org

I couldnt find the answer by searching and I guess the answer would be no. But does the Hibernate JPA API support entity-name ? Basically I have several mappings to the same class but want to refer to the mapping using the entity-name instead of the concrete class in Java Code/EJB-QL. Can someone confirm this ? Thanks, -Guillaume

24. Get table name from entity    forum.hibernate.org

I have done some searching and I haven't found anything on how to do this. I want to get the table name that an entity is associated with. I thought this would be a function on the ClassMetadata, but I found no such thing. Is this even possible? I wanted to avoid having to use static final variables for the table ...

25. Problems using entity-name    forum.hibernate.org

Hi. Im using Hibernate Core 3.2.4 and have some problems using the attribute entity-name in mapping-file. I use that because I want to persist different instances of class Properties in different tables. I have a class Document and another one called Properties: Code: public class Document { ..... ...

26. support for in JPA En    forum.hibernate.org

We are developing a new application running against a legacy Sybase 12.5.3 database. We have a requirement/nice-to-have for this new application that it utilize JPA exclusively for application data access. This database instance has numerous occasions where the same table structure is repeated across multiple schemas (i.e. Sybase databases). We are able, using vanilla Hibernate to map a single class that ...

27. entity-name and "persistent class not known"    forum.hibernate.org

Hibernate version: 3.1.2 I'm trying to use entity-name to map a series of objects to two different tables, but I get the following error on startup: Code: Caused by: org.hibernate.MappingException: persistent class not known: uk.co.formfill.dfcommon.domain.dfwv.NoteHeader at org.hibernate.cfg.Configuration$1.getIdentifierType(Configuration.java:1917) at org.hibernate.type.EntityType.getIdentifierType(EntityType.java:226) at org.hibernate.type.EntityType.getIdentifierOrUniqueKeyType(EntityType.java:236) at org.hibernate.type.ManyToOneType.getColumnSpan(ManyToOneType.java:41) at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253) ...

28. org.hibernate.MappingException: Unknown entity: Names    forum.hibernate.org

Hibernate Community View topic - org.hibernate.MappingException: Unknown entity: Names Login Register FAQ Search View unanswered posts | View active topics Board index Hibernate & Java Persistence Hibernate Users All times are UTC - 5 hours [ DST ] org.hibernate.MappingException: Unknown entity: Names Page 1 of 1 [ ...

29. 3.3.2.GA - Unable to resolve entity name from Class    forum.hibernate.org

After upgrading (from 3.3.0.SP1) to 3.3.2.GA we have started getting the follow stack trace logged: Code: org.hibernate.HibernateException: Unable to resolve entity name from Class [com.cyclone.netPrefect.admin.restriction.complex.TimeSpanRestrictionItemEntity] expected instance/subclass of [RestrictionItem] at org.hibernate.tuple.entity.PojoEntityTuplizer.determineConcreteSubclassEntityName(PojoEntityTuplizer.java:363) at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3643) at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1375) at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:203) at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:535) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:103) ...