entity 1 « Entity « JPA Q&A





1. How to initialize Hibernate entities fetched by a remote method call?    stackoverflow.com

When calling a remote service (e.g. over RMI) to load a list of entities from a database using Hibernate, how do you manage it to initialize all the fields and references ...

2. Difference between JPA Entity and Hibernate Entity    stackoverflow.com

When I annotate a class with @Entity and try to resolve the dependencies, I get to choose the package between two different packages, javax.persistence.Entity and org.hibernate.annotations.Entity The javax package is JPA's entity-annotation, ...

3. Hibernate implicit entity restrictions    stackoverflow.com

Is any way to add implicit restriction to entity in HQL? For example when we query list with hql "from Client" we need select only thouse clients, that have some particular ...

4. JPA - Use case - How to make entity    stackoverflow.com

I have server Entities.... Suppose an Entity named Exam this entity has a long ID... There are serveral types of exams... Exam_Numeric, Exam_Boolean etc..... which use the same ID (shared id) with Exam... depending on the ...

5. Java/Hibernate using interfaces over the entities    stackoverflow.com

I am using annoted Hibernate, and I'm wondering whether the following is possible. I have to set up a series of interfaces representing the objects that can be persisted, and an interface ...

6. out-of-the-box way to get an idmap from hibernate for a given entity?    stackoverflow.com

Over and over again I notive myself getting a list from hibernate, and the first thing next is put it in an idmap like:

List<House> entities = s.createCriteria(House.class).list();
Map<String,House> entitymap  ...

7. Maintaining JPA Entities    stackoverflow.com

We are in the beginning coding phase for project that we are using JPA with. We used the tools in Netbeans to generate our JPA entities based on our schema. It ...

8. How do I check that an entity is unreferenced in JPA?    stackoverflow.com

I have the following model

@Entity
class Element {
    @Id
    int id;

    @Version
    int version;

    @ManyToOne
   ...

9. Can i send an @entity through TCP java socket?    stackoverflow.com

all my test fails ... so is possible send an @entity using a TCP socket? UPDATE Problem is related at this post http://stackoverflow.com/questions/3097269/hibernate-send-entity-through-tcp-lose-persistentbagor-not-update-it Thanks.





10. Deep copying of JPA entities    stackoverflow.com

I have to do a deep copy of an entity. Basically there is a domain object whom I have to replicate so we need to do the deep copy of the ...

11. One-To-Many with the same entity    stackoverflow.com

I'm doing reverse engineering from the database schema (using Hibernate) and I want to have following in the resulting entity:

public class Task implements Serializable {
    ...
   ...

12. How does hibernate populate the entities    stackoverflow.com

very stupid question since I've been using hibernate for some time now but I was facing a special case and suddenly realised that I'm not sure how hibernate populates the DB ...

13. Data sharing amongst JPA Entities    stackoverflow.com

Setup: I have a simple web app that has a handfull of forms, each on a separate page. These forms represent patient data. There is a one-to-one relationship between patient and ...

14. How to declare Entities on the fly?    stackoverflow.com

I try to develop a Java Plugin application using the Java plugin framework. All plugins will have acces to a uniq database using JPA (with Eclipselink). But each plugin will ...

15. Hibernate: Entities vocabulary(in-memory storage)    stackoverflow.com

Vocabularies is common thing when using pure SQL. Just store some static tables(rarely updated entries - such as types, cities list, etc.) in memory and update when needed - very ...

16. JPA : Ideas to track the evolution/changes of the entities    stackoverflow.com

I was wondering is there any easy way to implement the tracking of changes in the entities ? There is Envers from Hibernate to have an audit, but as far as I ...





17. Java / JPA : How to make an Entity read-only?    stackoverflow.com

What is the proper way to make an Entity read-only with JPA ? I wish my database table to never be modified at all programmatically. I think I understand that I ...

18. JPA: Creating an entity whenever another entity is created    stackoverflow.com

I'm using JPA/Hibernate over PGSQL DB. I have an entity in my application, and I want to persist another entity (of a different type) every time the first entity is persisted. For ...

19. Assigning Behavior to JPA entities. Adding addional behavior to Entity    stackoverflow.com

Folks, Can I assign addional behaviour to JPA entity: i.e.

@Entity 
public class SomeEntity implements  XMLize ....
Is that valid? Thanks.

20. Non managed entity in hibernate    stackoverflow.com

I have 2 tables for which i have created a pojo with required fields and running hibernateUtil.createsql query. Below is my query

SQLQuery query1 = session.createSQLQuery(query);
/* do other stuff */
query1.setResultTransformer(new AliasToBeanResultTransformer(ActFav.class));
actFav=query1.list();
But i ...

21. JPA - "versioned" entity, design advice needed    stackoverflow.com

Imagine the following two entities. Element is simple class containing some data:

@Entity
public class Element {
    private String data;

    public String getData() { return data; } ...

22. Hibernate and dynamical wrapper for entity    stackoverflow.com

Probably a common problem, but anyway: Let's say I have a simple entity Task with a list of Activity entities:

@Entity
@Table(name = "task")
public class Task {

    @Id
    ...

23. JAXB Factory for JPA entities    stackoverflow.com

In most of my previous projects I have two domain models, one with JAXB annotations and the other one with JPA annotations. I know they can combined into one model with ...

24. Creating entities rules    stackoverflow.com

I'd like to know the answer to this simple question. When I create an entity object and I want to restrict a setting of an attribute (for example I don't want to ...

25. Recreating an entity using open JPA    stackoverflow.com

I'm facing quite a basic issue (allegedly..). This is the structure I'm refering to: Structure I'm working with flex in the client side, Java & open JPA in the server side ...

26. Is it possible to have remotely managed entities?    stackoverflow.com

I'm not much familiar with JPA, but I have this scenario: I would like to use the same classes (read "code") on both the server and the client (Java SE) for ...

27. Leaving Audit information from Entity JPA    stackoverflow.com

I have a table that has audit information in the same table. I want to create entity without the audit columns. Is it possible in JPA. e.g Person Table columns: name, address, (audit information)insertTime, ...

28. Custom entity persister for entities    stackoverflow.com

I am looking for a way to set a custom entity persister for all my entities. One of the way hibernate allows is to use the @Entity annotation (persister attribute) to ...

29. Transparently recording the last modified user on JPA entity    stackoverflow.com

I have found the technique in the answer below very useful for transparently managing the created and updated timestamp for entities: hard time setting autogenerated time with hibernate JPA annotations I am ...

30. Preparing a JPA entity for use by a HTML form    stackoverflow.com

Say I want to populate a JPA entity using values supplied by a user through a web application form (Tapestry for that matter). What is the best way to obtain the "blank" ...

31. How can I avoid the creation of superfluous entities?    stackoverflow.com

In my current project I need to perform a few native queries which pick some fields from tables joined in the query e.g.:

SELECT t1.col1, t2.col5
FROM t1
JOIN t2 ON t2.id = t1.t2_id
I ...

32. Lucene only finds a few hits    stackoverflow.com

Im trying to do a simple search on a Domain.class entity. I have two test. The first should create the indexes and the second does a actual search. When I run ...

33. QueryDsl Intellisense / Netbeans problems    stackoverflow.com

I have all the QueryDSL jars referenced from the all directory in my libraries. My problem NetBeans is not seeing the "Q"objects. They are generated to the same directory as all ...

34. How can you use Builder Pattern for entities with JPA    stackoverflow.com

I read that it's useful to use builder pattern when you have a class with a lot of parameters. I wonder how you can implement an entity using builder pattern. ...

35. Creating Envers custom revision entity    stackoverflow.com

I'm trying to setup audit for our project. I started from the default configuration which works fine. The next step is to store the user which has made changes. Following the manual I created ...

36. JPA entities creation wizard    forums.netbeans.org

If by "2 schemas" you mean 2 dbschema files, you can't. If you mean 2 schemas in the database, you may be able to capture both into a single dbschema file ...

37. Calculations for JPA entities    forums.netbeans.org

Hi there! I have created an OrderItem entity, for a corresponding table in my Orders database, which has several properties/fields including StockCode and UnitPrice. When the StockCode property is set I want to get a unit price out of a Stock_Item table in a different database called Stock and set the UnitPrice property in the OrderItem entity. My first question is: ...

38. JPA problem "not an entity"    forums.netbeans.org

I am getting the following error message: nternal Exception: Exception [EclipseLink-7250] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ValidationException Exception Description: [class com.dermvision.ps.Patient] uses a non-entity [class com.dermvision.ps.Encounter] as target entity in the relationship attribute [field encounters]. at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:126) at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:133) at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65) at javax.persistence.Persistence. createEntityManagerFactory(Unknown Source) Here is the definition of the Encounter entity: @Entity public class Encounter implements Serializable { private ...

39. Distribution JPA entities - enhancement etc.    coderanch.com

Dear friends, I am combining two concerns into one post here. Let me provide a context first. I am creating a simple string localization package which contains a singe JPA entity, LocalizedText. This package is subsequently being consumed consumed by other products which have JPA entities of their own. I am using JPA 1.1.0 and as part of my component release, ...

40. Entities and JPA    coderanch.com

41. Best practice for packagine JPA entities for use in client app server    coderanch.com

Hi, I'm just starting out on the road to learning JavaEE5 and JPA. I've created a set of JPA entities (all in Eclipse 3.4 using the WTP's various JPA & JavaEE projects) and added them to an EAR file. Access to the JPA entities is via a set of session beans, packaged in an EJB jar and added to the same ...

43. [ASK] designing an entity in hibernate    coderanch.com

44. How to couple JPA entities to a GUI?    coderanch.com

Hello, I have a question about how you "couple" JPA entities to a GUI. I am designing a database application for a company where they can store orders, customers, employees, invoices etc. The database is stored into SQL Server 2008, and I use Netbeans 6.8 to develop the GUI. At this moment all tables and connections are generated, now I am ...

45. JPA entities -- org.hibernate.TypeMismatchException    coderanch.com

Environment: JDK 1.6, JEE5 Hibernate Core 3.3.1.GA, Hibernate Annotations 3.4.0.GA DB:Informix Used reverse engineering to create my persistence entities from db schema [NB:This is a schema in work i cannot change] Getting exception when selecting list of basic_auth_accounts org.hibernate.TypeMismatchException: Provided id of the wrong type for class ebusiness.weblogic.model.UserAccounts. Expected: class ebusiness.weblogic.model.UserAccountsId, got class ebusiness.weblogic.model.BasicAuthAccountsId Both basic_auth_accounts and user_accounts have composite primary ...

46. Populating JPA managed Entity from non-JPA managed entity    coderanch.com

Hi We have requirement where we have one Schema with all Tables are managed using JPA so has mapping between Tables and POJO is in place. Now everyday some process runs brings new data in Non- JPA managed tables from those tables based on some ETL presently system loads JPA managed tables. Now we have requirement is to populate JPA managed ...

47. Use the entity itself as IdClass, does it work?    forum.hibernate.org

Hello, I have a huge legacy database with loads of tables which have composite keys. To avoid creating a separate classPK for all my entity classes (of the quite huge legacy database I work with using hibernate), I came up with a (maybe crazy) idea. Can I not use the "main" entity as IdClass as well? Consider this: Code: import java.io.Serializable; ...

48. @Entity + @XMLRootElement woes    forum.hibernate.org

Hi guys, I'm trying to set up a simple REST system with Hibernate and JAXB. I do a session.load(), get a proxied object and try to convert the object via JAXB, but the @XMLRootElement annotation doesn't show up. I couldn't see any annotations on my proxied object with either CGLib or Javassist. How can I tell the proxying process to add ...

49. How to set Entity in JPA --Beginner question---    forum.hibernate.org

Hi all i want to build my DB with JPA. I have an inner class which is extended from Hashmap but i don't know how to set the annotations correctly: I have following example for my issue: It's a 1:n relation Table Car: id|anyContent1|anycontent2 ----------------------------- 1|Porsche | 911 2|OPEL | Astra Tabelle CarItem id|key |value |car_Id ----------------------- 1|color |green|1 2|seats| 4 ...

50. JPA entities -- org.hibernate.TypeMismatchException    forum.hibernate.org

Author Message shavo26 Post subject: JPA entities -- org.hibernate.TypeMismatchException Posted: Mon May 17, 2010 8:21 pm Newbie Joined: Mon May 17, 2010 8:06 pm Posts: 5 Environment: JDK 1.6, JEE5 Hibernate Core 3.3.1.GA, Hibernate Annotations 3.4.0.GA DB:Informix Used reverse engineering to create my persistence entities from db schema [NB:This is a schema in work i cannot change] Getting exception ...

51. problem/question: getNamedQuery + non-managed entity    forum.hibernate.org

Hi, I need to do some complex SQL for report app. Is it possible to use "getNamedQuery" method to avoid write long SQLs on source code? I would to do something like the following code: Code: List result = getSession().getNamedQuery("findCompaniesByCode") .setResultTransformer(new AliasToBeanResultTransformer(Company.class)) .list(); where Company is a simple pojo (without any annotation/mapping). Then query "findCompaniesByCode" ...

52. Ejb3Configuration vs. Entity Scanning    forum.hibernate.org

53. Send entity through TCP lose persistentBag    forum.hibernate.org

Hi all, i'm trying to send an @entity class through TCP from server to client, this entity has a @OneToMany list. The problem is the object that i send has a populated list, but when i receive this object has a list with only one element! Where is the problem? ps. list is a persistentBag hibernate object.

54. @SqlResultSetMappings without Entity    forum.hibernate.org

I do not know if this is a bug or whether it should work this way, but I have the following issue: I have Entity classes which define my Business Logic. To do stuff I have created Manager classes which are more or less the same as Stateless beans (For legacy reasons we need to use Tomcat, so no true EE ...

55. Describing hibernate entities    forum.hibernate.org

I'm currently trying to write some code, that can take a hibernate class and be able to identify whether a certain property is a persisted hibernate field, or a transient non-hibernate field. Beyond rolling my own solution, I was wondering if any one had either tried this before, or if there are classes in the hibernate API that could be utilised ...

56. Consensus about how to handle entities in the view layer?    forum.hibernate.org

Newbie Joined: Wed Sep 01, 2010 12:36 am Posts: 1 This seems like such a basic issue that I would feel foolish bringing it up, except that I've researched it on and off over the past few years, reading many blog posts and forum threads, without drawing any firm conclusions. That is, if there is a general consensus among the Hibernate ...

57. Multilingual Entities    forum.hibernate.org

We have a requirement that our domain entities must support multiple language descriptions. We have developed a base table structure for all products that insures each product gets a unique key, then based on this key and a language id, the descriptions of the products are stored in a separate table called product_descriptions. Therefore given a single product ABC, I have ...

58. Same entities from multiple views    forum.hibernate.org

Hello. I have a database schema with one central transactions table and multiple views of that table. For simplicity, let's call the transactions table "TRANSACTIONS" and the views would be simple filters like "SUCCESSFUL_TRANSACTIONS" and "TRANSACTIONS_THAT_FAILED_WITH_ERROR_30" or something. All of these views have the same columns as the main TRANSACTIONS table; they're really just (complex) filters. The application I am writing/redesigning ...

59. JPA entity question    forum.hibernate.org

Newbie Joined: Mon Dec 13, 2010 6:43 pm Posts: 1 I'm having some problems figuring out what's the right way to approach this. I'm an absolute newbie Two entities: [*]User class which contains all of the information about the user. [*]Logentry class will contain information about the visited page. There's not always going to be a User associated with it. So ...

60. Hibernate autodetection: adding an Entity propertiy: How?    forum.hibernate.org

Hi, I have a J2EE application using Hibernate. Hibernate is configured for auto detection: java:/mySQLDB org.hibernate.ejb.HibernatePersistence I need to add a new property (language) to an existing Entity: @Entity @Table(name = ...

61. really no final method allowed in entity?    forum.hibernate.org

According to Hibernate's (3.6.0) spec section 21.1.3 ("Single-ended association proxies"), such a proxy can't be constructed by Hibernate if it contains "any final methods". My question is, does this restriction apply to getters/setters of persistent fields only or really to any method in an entity class? So, does a method like this one: Code: public final String toString() { ...

62. problem with creating entities    forum.hibernate.org

Beginner Joined: Wed Oct 22, 2003 11:26 am Posts: 31 I have one Parent (id,name) table and one Child(childId,childName,parentId(FK to id of Parent)) table. I am trying to create a parent and hibernate generates insert query for Parent table and update query for Child table. My problem is that it isnt generating insert statement for Child table which thorws the following ...

63. Circular Entity - Once and for all?    forum.hibernate.org

Newbie Joined: Mon Feb 09, 2004 10:00 pm Posts: 15 I haven't found a single, complete example of a circular relationship in an entity. I promise that any information I get during this thread, I'll add to a document in the wiki or somewhere. What I have works, but it is extremely inefficient. Consider a simple Category object that contains a ...

64. Materializing unwanted entities    forum.hibernate.org

The following code works perfectly but I can't understand why all the entities included in the composite key (see mapping) are materialized (see log). Isn't Hibernate able to generate the SQL statement without having to fetch the whole object? If this is the expected behaviour of the query, does Hibernate supports a different way of querying that prevents this behaviour in ...

65. CMP Entity in Hibernate    forum.hibernate.org

i have running CMP entity beans on jboss3.2.3 and im not satisfied with the speed of cascade deletes, and the abscence of support for oracle sequences is annoying. I've been told about Hibernate as powerfull or mapping engine. My question is: could Hibernate help me to solve me my problem with the minimum changes in source code ( I'd like to ...

66. API to check if entity is new    forum.hibernate.org

This is what happens in SessionImpl.saveOrUpdate: Code: Boolean isUnsaved = interceptor.isUnsaved(object); ClassPersister persister = getPersister(object); if (isUnsaved==null) { // use unsaved-value ...

67. Read-Only entities    forum.hibernate.org

I am using Hibernate 2.1 with ORACLE 8. In a Hibernate Transaction if I am certain than instances of a particular entity class would be read but never updated, are there any optimizations I can do to hint Hibernate not to bother synching those instances to DB? In a popular commerical ORM tool I had used, Unit-Of-Work makes available copies of ...

68. How to model defined with undefined entities    forum.hibernate.org

Hibernate version:3.0 I've posted something similar to this elsewhere, but I want to repeat it to refine it. I've spent more than a week trying to model my domain but I can't seem to make it work with Hibernate. Let me give you an overview of my schema. I have three tables of interest: Documents doc_id fc_id name ... Filecabinets fc_id ...

70. Can you create entities from views    forum.hibernate.org

71. Checking if entity exist    forum.hibernate.org

Query it? How? session.createQuery("from SomeEntity").list() throws exception, if SomeEntity does not exist. I don't like this way. I can't use session.get() either, because I can't imply that particular id is valid. Entity name is passed to servlet as a request parameter. Servlet calls Dao layer and obtain list of objects from table mapped to this entity. But if entity don't exist, ...

72. wrap/decorate entity    forum.hibernate.org

I try some experiment and maybe need some suggestions. The idea behind my experiment is to get rid of LazyInitializationException and detached objects in an JSF (or webapp in general) application but still using the session-per-request pattern. The only exception is StaleObjectException on version conflict - and this is wanted. I found a way to wrap a entity using cglib and ...

73. No tuplizer found for entity-mode    forum.hibernate.org

Hi, I recently upgraded my application from Hibernate 2 to Hibernate 3.0.5. I follwed the migration instruction for Hibernate 3. My application ran fine with Hibernate 2. When running with Hibernate 3 I constantly get the error: "No tuplizer found for entity-mode [pojo]" Does anybody have a clue why I get this error message?It is obvious that the exception is thrown ...

74. Obtain readonly entity?    forum.hibernate.org

There is some discussion going on in my place of employment about Hibernate's behavior in always returning new instances of objects from the second-level cache rather than returning a single cached instance (in comparsion with TopLink, which does the latter). The issue under discussion is the efficiency of creating unnecessary instances. I personally prefer the way Hibernate does it because it ...

75. getId call for many-to-one retrieves the 'one' entity    forum.hibernate.org

Hi, I have a simple bidirectional parent <-> child mapping where parent has a one-to-many mapped set of children and child has a many-to-one mapping for its parent. (Hibernate 3, everything lazy) If I do a child.getParent().getId() hibernate executes a loading query for the parent. To my understanding this load should not happen. I expect a proxy from getParent() and the ...

76. ReplicationMode.IGNORE doesn't check on unflushed entities    forum.hibernate.org

Author Message Gregory Chazalon Post subject: ReplicationMode.IGNORE doesn't check on unflushed entities Posted: Thu Jan 05, 2006 12:50 pm Newbie Joined: Thu Jul 21, 2005 5:37 am Posts: 9 Location: Paris Hi, I suspect that the replicate() method with replication mode IGNORE does not actually check the previously unflushed entities in the session. It seems to just check the ...

77. How to manipulate Hibernate entities directly?    forum.hibernate.org

Hi everybody! I am currently trying different persistence frameworks. Hibernate seems very mature as well as powerfull. Nevertheless, i am adopting a model driven approach, and as a result, the persistence layer won't be hand coded but rather generated, so i don't have the same constraints as other hibernate users. Moreover, a service layer (actually a layer implementing business services) needs ...

78. How can i have UnMappedproperties in entity    forum.hibernate.org

79. How to get entities and their counts    forum.hibernate.org

Here's something I'm grappling with. I've got a db and have mapped it with Hibernate. Now I have a new requirement on an existing screen. I've got a Company entity. It has Products. These products have Uses. The Products have to be approved for each Use separately. Each Approval has a date associated with it. I want to query my db ...

80. Pluggable entity modes?    forum.hibernate.org

Is it the intention to be able to have pluggable entity-modes with hibernate - ie in addition to dynamic-map, dom4j and pojo? We have a requirement to persist/load dynamic map-like objects (similar to SDO DataObject's) - and while we can use the dynamic-map entity mode, I am conscious of the overhead of copying between maps & our DataObjects... Thanks. -Nick

81. Problem trying to use a custom entity persister    forum.hibernate.org

82. "Could not configure entity resolver" Problem    forum.hibernate.org

hi, I am using hibernate 3 with Eclipse 3.1. on "Hibernate Configuration" tab, when I am trying to "Create SessionFactory", I get the following exception with the heading "Exception while connecting/starting Hibernate": [code]org.hibernate.console.HibernateConsoleRuntimeException: Could not configure entity resolver tyn.cm.hibernate.Member org.hibernate.console.HibernateConsoleRuntimeException: Could not configure entity resolver tyn.cm.hibernate.Member java.lang.ClassNotFoundException: tyn.cm.hibernate.Member[/code] The class Member is in its package and generated by the hibernate tool, ...

83. QueryException: not an entity    forum.hibernate.org

/** * @hibernate.map table="userprops" lazy="true" cascade="all" * @hibernate.collection-key column="userid" * @hibernate.collection-index column="mapkey" type="string" * @hibernate.collection-element column="value" type="string" */ public Map getProperties() { return ...

84. New Statistics: Used entities    forum.hibernate.org

Hi all, I'm trying to optimize the startup times of my hibernate based application (Hibernate Version 3.1.2 + Annotations). Currently the hibernate startup takes approx. 8 seconds for 229 classes. 1 second is spent creating the configuration, 7 seconds building the session factory. That is actually not bad - something like 0,03 sec per class with most time spent doing some ...

85. many-to-many with 3 Entities    forum.hibernate.org

I have three tables Organization, Users and Roles. The three are related by ORG_USER_ROLE table with three keys to each of the above three tables. I have seen documentation and forum examples with 2 entities. Does Hibernate have a mapping to handle 3 entities? If not I have to do this without the many-to-many mappings and treat each table independently. Thanks ...

86. many-to-many with 3 Entities    forum.hibernate.org

I have three tables Organization, Users and Roles. The three are related by ORG_USER_ROLE table with three keys to each of the above three tables. I have seen documentation and forum examples with 2 entities. Does Hibernate have a mapping to handle 3 entities? If not I have to do this without the many-to-many mappings and treat each table independently. Thanks ...

87. The recovery for a set don't work in 2 of 3 entities in M:1    forum.hibernate.org

Hello, I have a problem to retrieve a set of entities. I have the next relationships: Alumno --- one-to-many --- FormasRptas Ramo --- one-to-many --- FormasRptas Forma --- one-to-many --- FormasRptas For example, I load 3 entities, they have relation with FormasRptas: Alumno al = (Alumno) sess.load(Alumno.class, idAl); Ramo r = (Ramo) sess.load(Ramo.class, idRamo); Forma f = (Forma) sess.load(Forma.class, idForma); and ...

88. Various questions about creation of new entities.    forum.hibernate.org

We have an application (spring framework + hibernate3) which manages entities, in the way that we allow inserts, updates, deletes and searches of these entities (like millions of applications out there, I know). Each entity has its own java bean, and the subsequent hibernate mapping (.hbm.xml) and implementation for the persistent tasks (obvious). A POJO entity model, right. That we want ...

89. Problem in many-to-many with intermediate entity    forum.hibernate.org

Hello: Please, need your help. I have Teacher ---many-to-many --- Course then, I did create a new entity (intermediate), because I have properties in the relation, This intermediate entity is TeacherCourse, then Teacher ---one-to-many ---TeacherCourse TeacherCourse --- many-to-one Course My problem is: I have 5 courses in DB, (a,b,c,d,e), and I have 2 teachers (F and G). F to teach a,b,c ...

90. detecting changes in an entity.    forum.hibernate.org

I'm assuming your detached objects are no longer associated with a Hibernate Session, which of course would handle automatic dirty checking. What I've done before is set a boolean flag in each of my object's setters if the value has changed. private boolean changed = false; private String firstName; public void setFirstName(String firstName) { setChanged(this.firstName != firstName); this.firstName = firstName; } ...

91. one-to-one and one-to-many for the same entity    forum.hibernate.org

Hi all! its possible to map a one-to-one relation and the same time mapping a one-to-many to the same entity? Or its a concetual error? for example: I have follow diagram: each 'MS' (Message) must have one 'SE' (Recipient). thats the 'fr' (from) relation. in the same time I have tree other relations (1-N) from 'MS' to 'SE'. (to, cc and ...

92. Entity onAccess    forum.hibernate.org

Hello! I'm using a DefaultLoadEventListener, method onLoad, to keep track of which entities are loaded in my session. Whenever I do a HQL-query, a get, a load - I want to know that I'm accessing the entity. Problem is, when my entity is first loaded, no other onload-events are triggered, since the entity then resides in the session cache. So... Is ...

93. Scalar SQLQuery returned as managed entity    forum.hibernate.org

Newbie Joined: Wed Feb 14, 2007 11:18 am Posts: 10 Hibernate Version 3.1 This is a "reporting" application. All the data is coming out of a warehouse, and we have control over the schema: We are building custom tables to flatten out the data even more that the warehouse does already. (MSSQL 2000/2005 databases) Here is the mapping for a typical ...

94. Create new entity in Pre/PostUpdateListener    forum.hibernate.org

Is it possible to create new entity in Pre or PostUpdateListener? I see that my listener is being called, but creating entity has no effect on database. Example class MyListener implements PreUpdateListener { public boolean onPreUpdate(PreUpdateEvent event) { if (event.getEntity() instanceof Dog == false) return false; LogEntry e = new LogEntry(); e.setText("Entity of class " + event.getEntity.getClass() + " updated."); event.getPersister().getFactory().getCurrentSession().persist(e); ...

95. Create new entity in Pre/PostUpdateListener    forum.hibernate.org

Is it possible to create new entity in Pre or PostUpdateListener? I see that my listener is being called, but creating entity has no effect on database. Example class MyListener implements PreUpdateListener { public boolean onPreUpdate(PreUpdateEvent event) { if (event.getEntity() instanceof Dog == false) return false; LogEntry e = new LogEntry(); e.setText("Entity of class " + event.getEntity.getClass() + " updated."); event.getPersister().getFactory().getCurrentSession().persist(e); ...

96. Get the same entities?    forum.hibernate.org

Did you implement the equals() and hashCode(), cause that's exactly what should be done and make your test pass here... Session is a short-lived object, so you shouldn't consider keeping it a long time. There's some pattern to make it possible (disconnecting it, and reconnecting, and so on), but that's not the simplest one. What's your architecture btw? Web? Swing/Swt app? ...

97. Create an entity, or use an existing?    forum.hibernate.org

Hi, I using hibernate for the persistence of a wide set of Java objects. I am currently persisting as entities, and mostly things are fine. However, there are a couple of areas where I require to improve the logic in the persistence process, and am not sure whether I can achieve this with the mapping, or whether it needs application level ...

98. Transforming VOs to Entities in client tier    forum.hibernate.org

I have question related to the "Hibernate in a Layered Architecture" document (http://www.hibernate.org/124.html). Background: I am developing an application where the front-end is a Swing app and physically separated from the server. I would like to transfer information to this Swing client using DTO's because pushing enties would be very inefficient (large object graphs) and error prone (in case some proxies ...

99. Conditional deploying of entities - is it possible?    forum.hibernate.org

We need to prevent deploying of some entities depending on the information stored in the database. For example, when a new version of application is deployed against an old DB schema (where some new tables are missing), deploy of entire application fails. What we need (ideally) to be operational with entities that can be deployed, or (at least) politely say to ...

100. How do dublicate an entity    forum.hibernate.org

Author Message FT77 Post subject: How do dublicate an entity Posted: Fri Nov 23, 2007 6:17 am Newbie Joined: Wed Jun 06, 2007 8:09 am Posts: 14 Location: Germany Hi, I am trying to duplicate an Entity including it's referenced entities (oneToMany). The idea is to have a template which can be copied, used and modified. This Template is ...