Persist « Update « JPA Q&A





1. Persisting using hibernate/JPA    stackoverflow.com

I have been working with hibernate/JPA on JBoss for some months now and have one question that I can't find an answer or solution for. It seems like when creating new entity ...

2. org.hibernate.annoatations vs. javax.persistence    stackoverflow.com

Is it a bad idea to use the annotations from the

javax.persistence package
instead of using the
org.hibernate.annotations annotations
I know that using javax.peristence does introduce yet another dependency. ...

3. What is the fastest way to learn JPA?    stackoverflow.com

I'm looking for the best resources (books, frameworks, tutorials) that will help me get up to speed with JPA. I've been happily using iBatis/JDBC for my persistence needs, so I need ...

4. Jpa or Hibernate for Java Persistence?    stackoverflow.com

I'm researching the development of Enterprise Applications in Java, .NET and Groovy. For each platform, we're going to try how hard it is to realize a simple SOAP web service. We'll ...

5. JPA/Hibernate persist does not appear to work    stackoverflow.com

I'm using JPA (Hibernate implementation) to save objects to the database. Selecting works fine, but for some reason, saving doesn't work. I don't get any errors, but the database doesn't get ...

6. Hibernate configuration    stackoverflow.com

I'm trying to get started with Hibernate, and when executing my program I get an error during initialization. The exception is thrown by this class, copied from here:

package net.always_data.bastien_leonard;

import org.hibernate.SessionFactory;
import ...

7. Hibernate custom type definitions    stackoverflow.com

Can someone please advise on how to define & map (using annotations) custom types in Hibernate? Eg, given:

@Entity
public class Line {
    private Point startPoint;
    private Point ...

8. When should you use JCR and when should you use JPA/RDBMS?    stackoverflow.com

The Java JCR API defines a persistence mechanism which can be used to replace many of the traditional roles of a RDBMS. For example, JackRabbit - the JCR reference implementation - ...

9. Preventing NaN from being persisted by Hibernate    stackoverflow.com

I am using Hibernate as my JPA provider with it connecting to a Progress database. When a NaN value is persisted it is causing lots of problems - it prevents the ...





10. How to Java Persistence Api with MS Access?    stackoverflow.com

I could not find any jdbc driver for ms access.So how can I connect MS Access with JPA ?

11. Persisting a set of Days of the Week    stackoverflow.com

I'm looking for an efficient way to persist a set of Days of the Week. In other words, a user will select any number of days from a list of ...

12. Java Persistence API    stackoverflow.com

I am new to Java Persistence API. I have just learnt it and now want to use it in my Java Desktop Application. But I have the following questions regarding it: Q1. ...

13. JPA - How to persist java.util.Set through JPA?    stackoverflow.com

I have a field aliases of type java.util.Set in one Entity. This Set doesn't denote any relationship to an Entity. Q1. How can I store this aliases field through JPA? Q2. How this ...

14. Which are the differences/similarities between hibernate and other frameworks or specifications?    stackoverflow.com

I want to know the differences/similarities between Hibernate and simple persistence in Java EE 5? I'm not clear if Hibernate implements Java EE 5 persistence implementation or if it is a totally ...

15. Persisting application settings with Hibernate    stackoverflow.com

What is the best/prettiest/most flexible way of storing application settings with Hibernate? Is a single row table the way to go, or is there a better way? The ability to store extra ...

16. Java Persistence frameworks    stackoverflow.com

I am in need of some further information. I am developing a small application which will be interacting with a PHP web application. The media server which we are incorporating with ...





17. Hibernate Monitoring Solution    stackoverflow.com

I would like to monitor hibernate action. I see on the internet the zentracker monitor solution that permit to monitor a lot of activity of hibernate. But It is compatible with the last ...

18. What are the security concerns that I need to look out for with Java Persistence API (JPA)    stackoverflow.com

I'm starting to learn JPA, and I have a considerable amount of legacy EJB2.0 code that will need to be refactored to use the new features, as well as any new ...

19. Should I upgrade / migrate Hibernate 2.5 to Hibernate 3.0 or directly to the newest stable release?    stackoverflow.com

I have got an application which uses Java SE 5 and Hibernate 2.5. I have to upgrade / migrate it to Java 6 and a newer version of Hibernate. What is ...

20. Hibernate JPA: how to write an efficent persist()?    stackoverflow.com

The below code seem simple, yet it takes me long time but turned out to be cumbersome and lengthy code even i dislike. could someone help me with some efficient code? ...

21. Hibernate - no updates on PersistentSet    stackoverflow.com

I am using JPA 2.0 standard and hibernate as the persistence provider. While working with ElementCollections I am curious to know why aren't org.hibernate.collection.PersistentSet updatable? The method isRowUpdatePossible() in PersistentSet returns false. ...

22. hibernate persistence    stackoverflow.com

I work with hibernate I create hibernate.cgf.xml and the mapping file. I create a class java for the entity and the hibernateUtil.java and when i run the test main it generate this:

Exception ...

23. hibernate persistence    stackoverflow.com

i get this error:

GRAVE: Could not configure datastore from file
hibernate.cgf.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
            ...

24. hibernate PropertyNotFoundException    stackoverflow.com

i already found some information about this exception but mine is very strange.

Caused by: org.hibernate.PropertyNotFoundException: 
Could not find a setter for property empty in class java.util.List
There is no information where is ...

25. 'java.lang.NoSuchFieldError' while using the JPA    stackoverflow.com

I am getting the following error while trying out this JPA tutorial:

java.lang.NoSuchFieldError: NONE
    at org.hibernate.ejb.QueryImpl.<init>(QueryImpl.java:609)
    at org.hibernate.ejb.QueryImpl.<init>(QueryImpl.java:80)
    at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:272)
  ...

26. Java Persistent API vs Hibernate 3    stackoverflow.com

What are my gains and loses if I choose Java Persistent API over Hibernate 3 ?

27. how to handle Set of not yet persisted entitys? Java JPA    stackoverflow.com

i have two tables mapped by JPA with One to Many relationship. I want to add Set to the Blog entity, but since BlogNodes entry did not persisted yet, they havent ...

28. TransactionAttribute.REQUIRES_NEW in JPA    stackoverflow.com

I tested my ejb jpa transactions. I use Container-managed entityManager:

@PersistenceContext(unitName = "ParticularUnit")
EntityManager em;
Such I has got transaction PersistanceContext scope and container manages each transaction. For each instance of pooled session beans, created ...

29. Hibernate and persistence    coderanch.com

30. Persistence in the Enterprise - Hibernate the top?    coderanch.com

See Chapter 4 of the Persistence in the Enterprise Book for a questionnaire to use to make the determination in your own culture and environment. Chapter 10 summarizes the evaluations we make for JDBC, iBatis, Hibernate Core, Open JPA and PureQuery in one place for easy reference. I have also been driving IBM towards an approach called Pattern based Engineering, which ...

32. Hibernate Persistence    coderanch.com

34. JPA - persisting only when I use EntityTransaction    coderanch.com

You must call commit() to have any changes committed to the database. In JPA changes are made to the object model in memory, to have the changes flushed to the database, either flush() or commit() must be called. The find() will find the object in the persistence context, even if it has not been flushed.

36. Marking owner of custom persistent set dirty when modifying    forum.hibernate.org

Hi - I am trying to build my own little application server. The application server is to use optimistic concurrency control, e.g. I use update ticks (Lamport) on every entity. More concretely I have a common interface that all entities must implement. The interface is called IObject: Code: public interface IObject extends Serializable { long getId(); ...

37. Java Persistence Experts Teaches JPA, Hibernate at GIDS 2010    forum.hibernate.org

Great Indian Developer Summit 2010 Gold Standard for India's IT Professional Ecosystem Bangalore, January 22, 2010: The introduction of the Java Persistence API signaled the beginning of the end of using proprietary Hibernate or TopLink mapping files and session APIs to persist your business objects to a relational database. While developers have flocked to the new standard and have been ...

38. Java Persistence Experts Teaches JPA, Hibernate at GIDS 2010    forum.hibernate.org

Great Indian Developer Summit 2010 Gold Standard for India's IT Professional Ecosystem Bangalore, January 22, 2010: The introduction of the Java Persistence API signaled the beginning of the end of using proprietary Hibernate or TopLink mapping files and session APIs to persist your business objects to a relational database. While developers have flocked to the new standard and have been ...

39. Hibernate persistence    forum.hibernate.org

40. After persist(A), A is in persisted but A.getB() is not    forum.hibernate.org

that's natural you asked for that. When you have A in the persistence context and then query for A, you will get the same reference back (A==A) because it was already in the persistence context. As you don't want it to cascade persist/merge B is still detached. If you want these things to "just work" you should use cascade persist/merge. A ...

41. Derby persist behaviour doubt    forum.hibernate.org

Hi everybody. I have a question to ask: as far as I know JPA persist operation only registers the object in the context of the EntityManager. But looks like that with Derby the sentence also triggers the insert operation in the database. I though it would be postponed until the transaction commit. Am I losing something or this is the most ...

42. Persisting a factory?    forum.hibernate.org

I have a problem with a factory of singletons and Hibernate. I need to have exactly one instance of objects of class MyObj for each possible value of the parameter name. So, when I execute MyObjFactory.getInstance().getMyObj("foo") (see the following code), always the same object must be returned. I also have to persist these objects, and I was wondering how to do ...

43. Hibernate JPA Persist() doesn't work    forum.hibernate.org

I tried following code Code: try { EntityTransaction tx = getEntityManager().getTransaction(); tx.begin(); getEntityManager().persist(entity); tx.commit(); } catch (RuntimeException re) { ...

44. Hibernate JPA persist() doesn't work!    forum.hibernate.org

I tried following code Hibernate JPA Code: try { EntityTransaction tx = getEntityManager().getTransaction(); tx.begin(); getEntityManager().persist(entity); ...

45. look-up in the "Java persistence with Hibernate"    forum.hibernate.org

46. Create and persist in inline editing    forum.hibernate.org

Hello Everybody, I have a table called " QuestionReponse " and another one called "Non Confirmite ". The " Non Conformite " table has a foreign key to the " QuestionReponse " table, and after generating entities I get an object of Questionreponse in the "NonConformite" entity. The "NonConformite" entity contains just two attributs, the ID (generated automatically) and the Questionreponse ...

47. Trouble persisting a set    forum.hibernate.org

I sifted through the documentation and this forum, but am having trouble finding what I am doing wrong. I am persisting a class "Person" which contains a set of "Address" objects. The person persists fine, but none of the addresses in the set persist. Here is what I am doing ... person.hbml.xml ...

48. Customized Set Persistence show-stopper    forum.hibernate.org

Hi, I have currently on my TODO list: "Make CollectionPersister an interface" This is not hard to do ;) Take a look at the net.sf.hibernate.collection package. In particular, decide if you would be able to make a custom CollectionPersister that would work in your environment. If so, I will accept changes to the collections package to allow this.

49. hibernate used in parallel with other persistent manager    forum.hibernate.org

Dear, we planned to reengineer all our applications base on a framework using hibernate as persistent manager. As our migration can not be done in one stage, I was wandering if it iwas possible to migrate the applications part by part, letting hibernate and our internal persistence mechanism working in parallel for a time. I know that it should have some ...

50. Persisting trouble with ternary    forum.hibernate.org

Hi. I posted a question earlier about ternary associations, but... The prblem is I can't make the code work. I have three classes; InfoContact, ContactField and ContactMeta. They all should be associated by a fourth class, ContactDataNode. The InfoContact object holds a List of ContactDataNode objects. ContactField and ContactMeta also holds a Set of ContactDataNodeObjects. I assume you have to "inform" ...

51. "declarative" security for persistent content    forum.hibernate.org

Hello, We need to implement business methods that return different (filtered) data based on a user's security roles. For example, a "manager" calls a business method that returns a List of Employees. An Employee object might contain a "salary" property, but in this case a "manager" should not be allowed to see the salary. However, when the "cfo" calls the same ...

52. writing wrappers for the Persistence frame works    forum.hibernate.org

53. I want "apparent" persistence    forum.hibernate.org

Scuse me while I don my flame-resistant overalls http://www.hudsonworkwear.com/bibs.htm... I want everything to work exactly as it does now, except I don't want my objects persisted unless I invoke save, create, delete, etc. on an entity. Only then do I want Hibernate to save my objects, and only those objects reachable from the entity I invoked the persistence method on. I ...

54. persisting interfaces    forum.hibernate.org

I'm trying to use Hibernate in conjunction with JAXB and Hibernate Synchronizer to persist my model to a MySql database. According to the doc: " It is perfectly acceptable for the named persistent class to be an interface. You would then declare implementing classes of that interface using the element." And here is the mapping: Code: ...

55. Understanding of Trasitive Persistence with Composition    forum.hibernate.org

I have a Object A which has a composite relation with Object B and I have Object C which has a composite relation with Object B. I do a save on Object A, but because I have cascade="all" on the relation, it goes to Object B and tries to persist it's elements. Unfortunately, Object B has a reference to Object C ...

57. how to persist a MultiHashMap    forum.hibernate.org

Hi, I am using the Commons Collections interface MultiMap and its implementation MultiHashMap and I would like to persist instances of it with Hibernate. MultiHashMap basically extends HashMap and for each key stores a Collection. I have read that Hibernate is not able to store this kind of Map. Does anybody know a work around or have any tips to solve ...

58. How to persist java.util.Locale?    forum.hibernate.org

Newbie Joined: Thu Nov 04, 2004 10:38 am Posts: 6 michael wrote: Why would you want to do that? IMHO thats not possible, at least not easily. My intention is to implement an object, that I only extend if I want to implement a multilingual entity. For example: Code: public class Multilingual extends Polyglot { } And here is the implementation: ...

59. Character encoding for persistence    forum.hibernate.org

61. Disable transparent persistence    forum.hibernate.org

unfortunately, i missed some bad effect with your solution... in fact, setting FlushMode to NEVER disable ALL changes to the database, which consist of setting the session readonly. my first goal was to disable automatic updates on setter calls, but not to disable all updates, inserts and deletes. i'd like to tell hibernate to update the database only on Session.update() call, ...

62. Persisting codes    forum.hibernate.org

Hibernate version: 2.17 Name and version of the database you are using: MS SQL Server 2000 My question is regarding persistence. I have codes (Locations, Departments etc.) in our system. For the very first user who login in the system, I want to retrieve these codes and persist them; all subsequent users then should use the persistent codes instead of retrieving ...

63. Using Hibernate to persist EMF EObjects    forum.hibernate.org

EMF is an object framework/serialization plugin to Eclipse shipped with Eclipse RT - Eclipse's core. It comes with Eclipse-based modelling tools to build object models. The problem is that EMF is not JMI based at this point. The model(s) are called ECore and they are used to generate EObjects instead of POJOs. I would like to treat EObjects like a POJO ...

64. How to persist a virtual variable    forum.hibernate.org

I'm pretty new to this whole hibernate bit.. and I was wondering if this is possible. I would like to do the opposite of a derived property (a formula in the xml). Lets say I have a class with two strings: FirstName, LastName However in the database, I would like to save it as FirstName +" " +LastName. AND.. i do ...

65. How to persist an author and his works    forum.hibernate.org

Beginner Joined: Wed Mar 30, 2005 5:41 am Posts: 40 Hibernate version: 3.0 Mapping documents: ...

66. javax.persistence API javadoc?    forum.hibernate.org

Yeah, in Eclipse I can explore the jar file and see what attributes are associated with an annotation, but I still can't get access to the docs that tell me what those attributes are supposed to control. So, where did the source for the ejb3-persistence.jar come from? If its not javadoc'd then it might not help, but I'm hoping that it ...

67. help needed - persisting an interface    forum.hibernate.org

Newbie Joined: Thu Jul 07, 2005 6:59 am Posts: 13 Location: Derry Northern Ireland Hi, I'm trying to persist an implementing class and the interface using the table per subclass mapping shown in the documentation. The example is straighforward, however I'm getting the mapping file muddled I think. Effectively I have two tables, Payment and Visa, Payment should be mapping to ...

68. Maintain persistence at all times    forum.hibernate.org

Hi, first off, I'm rather new to Hibernate. I've spent the last couple of hours browsing websites and manuals with different keywords, but so far have found not answer to my original problem. We are currently designing a system, which requires object persistence at all times. On startup, the objects are retrieved from the database. Objects created during runtime are passed ...

69. Persistent sets are *too* persistent - make em go away...    forum.hibernate.org

Very frustrating indeed. It is really a problem that the domain object has to have their collection - a Set interface *replaced* with a org.hibernate.collection.PersistentSet. Despite instantiating a new set and copying all the values over in a DTO fashion I still get the client spewing up: java.lang.ClassNotFoundException: org.hibernate.collection.PersistentSet at java.net.URLClassLoader$1.run(Unknown Source) On serialization - I mean what do I have ...

70. forcing hibernate to persist, how?    forum.hibernate.org

Hello all, I've a simple question (I hope). I have a EJB that stores serveral Tag objects. This is done in a for loop, and at the end of each loop I make a call to my persist method. The persist method is hidden behind a Delegate class. Now the persist is done, but not each time around the loop. All ...

71. Prevent changes from being persisted    forum.hibernate.org

Hi, I'm building a windows Forms application using nhibernate. Here's my problem. I have an object (ClassCliente) witch contains a collection(Contactos). I want to be able to undo the changes done to that collection if i cancel the operation of editing an object(ClassCliente). The problem is that, if i reload the objects it persists to the database the changes i have ...

72. Hibernate persistence with minimum configuration    forum.hibernate.org

Hibernate is a great persistence tool. Is it possible to favor so called conventions over configuration and cut the size of configuration files. For example is it possible to achieve following 1- I just provide hibernate main configuration file that provides minimum critical configuration along with the objects that I want to persist. 2- I just write my domain classes (classes ...

73. Changes to bi-directional many-to-many not persisted    forum.hibernate.org

Managed to find a solution. I was using hibernate-tools to generate the mappings from the database which set both side of the relationship to inverse="true". If changes to the relationship are to be persisted, at least one side must be marked as inverse="false" or have no inverse attribute set (the default for inverse is false).

74. What is a best practice for writing hibernate persistence?    forum.hibernate.org

I am writing some persistence classes for our database and I was given the direction to create interfaces for each entity in the DB then create implementation classes. This seems wrong, and in my opinion you would create abstract classes for entity objects like AbstractPerson instead of interfaces. Does it really make a difference if you create interfaces like PersionIntf and ...

75. persist vs update in long converstions    forum.hibernate.org

A co-worker and I have been having a discussion about objects that get read from external (not in vm) caches. Both of us are confusing ourselves. So the example is this. I load an Entity from a Session at the start of a conversation. I serialize the object to an external cache (ie, memcache d) after the session the is closed. ...

76. Java Persistence API architectures    forum.hibernate.org

i am learning Java Persistence API with Annotations and the Hibernate Entity Manager. My learning path objective is to implement and deploy a application in a JBoss cluster. Im writing a tutorial (and learning at the same time) for my website about this and all worked fine (DDL generation, annotations). For keeping it simple i'm trying to implement a Factory Method ...

77. Local Persistence    forum.hibernate.org

78. em.persist() and em.remove() with em.flushmode=manual    forum.hibernate.org

Hi, I'm using Seam's atomic conversations with session flushMode = MANUAL. I load (HQL queries) many entities and do many things with them before em.flush() is being done, such as creating new entities, removing existing entities, removing previously created entities (not persisted yet). I've noticed that when I create new entity, do em.persist with it and then do em.remove, I receive ...

79. hibernate persistence - behind the scenes    forum.hibernate.org

I am trying to understand how the constructor methods work in the persisting objects. I would like to know when the object will be instantiated? is it during the first db operation? what happens after that? does hibernate query the tables and store the data in objects? Is there a document that explains what exactly happens from start to end while ...

80. Hibernate Persistence HELP    forum.hibernate.org

I have been trying to add a persistence layer on a JSF web app with little luck. I am using Eclipse with Exadel Studio Pro. For the purpose of learning hibernate, I have created a very simple sample project. This project has one java bean (ProjectManager) that controls a class (Project) with four properties; id, name, client, location. The first page ...

81. Delayed persistence?    forum.hibernate.org

82. Make a EnumSet persistent    forum.hibernate.org

Hi, Hibernate version: 3.2.5 with mapping documents, not Annotations. I have a User-class that includes a property that is an EnumSet of authorities (=roles) granted to the user. This is for a learn-as-I-go sandbox-application. So I have modelled this in POJO-manner without taking Hibernate into account: Code: public enum Authority { ROLE_ANONYMOUS, ...

83. hibernate trigger not persisting.    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp 3.2.5 GA AuditTrail.hbm.xml Code: ...

84. Persisting Entites with multilingual text    forum.hibernate.org

hi all, is there a recommended way in Hibernate to store entites with multi-lingual values. My naive approach is to have an entity A that references an entity B (@OneToOne) containing the text and the languageId (see code example below). Then i could have a simple join from entity A to the entity B just specifying the desired language (my Repository ...

85. "Java Persistence with Hibernate" mistake :(    forum.hibernate.org

Can I map a Set in dynamic mode? Collections based on sets dont work with dynamic entity mode. In the previous code example, imagine that itemsForSale was a Set. A Set checks its elements for duplicates, so when you call add(item1) and add(item2), the equals() method on these objects is called. However, item1 and item2 are Java Map instances, and the ...

86. javax.persistence.*    forum.hibernate.org

87. Persisting Change In IndexColumn    forum.hibernate.org

class Store { @OneToMany(fetch = FetchType.LAZY) @JoinColumn(name = "STORE_ID", nullable = false, updatable = false) @org.hibernate.annotations.ForeignKey(name = "FK_FIELD_STORE_ID") @org.hibernate.annotations.IndexColumn(name = "FIELD_POSITION", nullable = false) private List fields = new LinkedList(); // And then the rest of it } class Field { // Various properties }

88. How to implement non persistent changes?    forum.hibernate.org

I have the following situation: 1. There is a complex graph of objects with all kinds of relations mapped to the database. 2. There is an abstract viewer(s), which receives a domain object and may display any data by navigating the links. We don't know beforehand which data the viewer may need/request. 3. There are editors which allow the user creating/modifying ...

89. Code snippets "Java Persistence with Hibernate" bo    forum.hibernate.org

Hi, I like the format of the book. However, when trying out the code snippet in the book, I could not compile it. I have to look for the jar files that might contain a class with the name used. It would be nice if a jar filename is mentioned or a "complete" name of the class is mentioned. For example, ...

91. Persist() is delayed    forum.hibernate.org

Newbie Joined: Fri Jun 19, 2009 5:04 am Posts: 1 I've got this persistence problem, I can't manage to persist my Entities to my MySQL database. I'm working with Spring+Hibernate and the JpaTransactionManager with an EntityManagerFactory. When I call the EntityManager.persist("entity"); I get this log result : 10:57:32,828DEBUG SharedEntityManagerCreator$SharedEntityManagerInvocationHandler:184 - Creating new EntityManager for shared EntityManager invocation 10:57:32,828DEBUG SessionImpl:220 - opened ...

92. javax.persistence.* not found    forum.hibernate.org

93. Java persistence    forum.hibernate.org

94. Anyone familiar in Hibernate?please help me?Say its persistence or not?    forums.oracle.com

/** constructor */ public User1(String string, String string2, String string3) { this.userName=string; this.userPassword=string2; this.userEmail=string3; } public User1() { // TODO Auto-generated constructor stub } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public String getUserName() { return this.userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserPassword() { return ...

95. persistence and hibernate (and maybe XFire)    forums.oracle.com

Sorry didnt know in which forum to post this. I have a very weird problem. We are using Springframework with XFire and Hibernate. All Database rows are implemented as Persistence Objects for Hibernate. So far it works well. We transfer this persistent objects over XFire between several Services which works too. But as soon as there is "Boolean" (NOT boolean) type ...