persist « Data Type « JPA Q&A





1. Hibernate: Persist an object as a String?    stackoverflow.com

Suppose I have an object like

public class Handle {
    private String handle;
    public Handle(String name) {
        this.handle=name;
  ...

2. Problem persisting a java.util.Date into MySql using Hibernate    stackoverflow.com

I've been debugging this problem for the last couple of hours with no success and figured I'd throw it out to SO and see where that goes. I'm developing a Java program ...

3. Toplink trying to persist null object    stackoverflow.com

I have an object "Instance" with another object "Course" inside. When trying to persist a new Instance object, I get the following error if Course is null:

java.lang.IllegalStateException: During synchronization a ...

4. Hibernate: OutOfMemoryError persisting Blob when printing log message    stackoverflow.com

I have a Hibernate Entity:

@Entity
class Foo {
    //...
    @Lob
    public byte[] getBytes() { return bytes; }
    //....
}
My VM is ...

5. JPA and PostqreSQL: long string persistence    stackoverflow.com

Can anybody tell me how to persist long text using JPA (I use PostgreSQL)? Here's the way I defined a very long string in my class:

@Lob
private String  body;
However, this produces a ...

6. How can I remove an item from a Hashmap in Hibernate?    stackoverflow.com

I try to delete an item from a hash map with hibernate. Here is my config on the collection:

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@OneToMany(mappedBy = "game", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@Where(clause = "charactType='charact'")
@MapKey(name = ...

7. how to use enum with jpa as a data member of persisted entity?    stackoverflow.com

Please best practice and 'how to' for using enum with jpa as a data member of persisted entity. what is the best practice? I want to persist "C", "O" from enum. (codes). If ...

8. Is there a way to prevent null values from being persisted while allowing others through?    stackoverflow.com

I have an existing JPA (EclipseLink) project where the desired behaviour is that if given a null value in a field for an entity, that null value should not be persisted. The ...

9. Issue persisting long strings with Hibernate    stackoverflow.com

In my web application, I have a text area whose user-filled contents are ultimately persisted to the db with Hibernate. I have been running into an issue that when the ...





10. Enum in Hibernate, persisting as an enum    stackoverflow.com

In my MySQL database, there's the column "gender enum('male','female')" I've created my enum "com.mydomain.myapp.enums.Gender", and in my Person entity I'm defined "Gender gender". Now I'd want to keep the enum type in ...

11. How do you persist a collection of Enums in Grails?    stackoverflow.com

Any ideas on how to persist a collection of enums in Grails? Groovy enum:

public enum MyEnum {
  AAA('Aaa'),
  BEE('Bee'),
  CEE('Cee')
  String description
  MyEnum(String description) {
   ...

12. Hibernate design: persistent data plus temporary run-time classes    stackoverflow.com

The question is this. I have a number of persisted objects that I'll pull using Hibernate. But during the application lifetime I'll create a few objects that do not live outside the running ...

13. Storing a jpa entity where only the timestamp changes results in updates rather than inserts (desired)    stackoverflow.com

I have a JPA entity that stores a fk id, a boolean and a timestamp:

@Entity
public class ChannelInUse implements Serializable {
  @Id
  @GeneratedValue
  private Long id;
  @ManyToOne
  ...

14. How can I resolve Hibernate 3's ConstraintViolationException when updating a Persistent Entity's CollectionOfElements?    stackoverflow.com

I'm trying to discover why two nearly identical class sets are behaving different from Hibernate 3's perspective. I'm fairly new to Hibernate in general and I'm hoping I'm missing something ...

15. GlassFish 2.1.1 - TopLink (JPA1) Persistence Exception 7106 - String Encryption Mistery    stackoverflow.com

I'm using NetBeans 6.8 and Glassfish Enterprise Server 2.1.1 ((v2.1 Patch06)(9.1_02 Patch12)) (build b31g-fcs). I created a servlet and used Netbeans code generation features to imlement persistence using TopLink (JPA1). When I ...

16. Persist enum with business value with hibernate annotations    stackoverflow.com

I have enum ClientType{INTERNAL,ADMIN}, i am able to persist enum with hibernate annotations. but inserted value is INTERNAL,ADMIN. How can i define my own vlaue. I want table to contain "I" for ...





17. How to use java.sql.Timestamp as real java.util.Date with JPA    stackoverflow.com

I have a problem about the management of dates with milliseconds. I understand the need to use the TIMESTAMP to store milliseconds:

@Temporal(TIMESTAMP)
@Column(name="DATE_COLUMN", nullable = false)
@Override public java.util.Date getDate() { return this.date; ...

18. Persisting time ojects as entities instead of value types?    stackoverflow.com

I'm using Joda Time DateTime to handle date and time. I persist objects of this kind using the class PersistentDateTime bundled in the jodatime hibernate code. I have ...

19. How to mix persistent and transient state of a domain object?    stackoverflow.com

I'm looking for a pattern/method do cleanly solve the following problem : In a on-screen display application (various information is displayed on LCD screens in public places), I have Hibernate persistent POJOs, ...

20. In Java, with JPA2, what class should I use for persisting date information?    stackoverflow.com

There are three options that I see for handling dates in Java, but I may be missing some better alternatives yet.

  1. java.util.Date - Which is fine, but is a very simple class ...

21. Persist raw Java Enum using Hibernate    stackoverflow.com

I have an entity that contains an enum property. That property can be any one of my types of Enums in my codebase:

public enum AutomobileType {
   CAR, TRUCK, MOTORCYCLE
}

public ...

22. How to persist a HashMap with hibernate    stackoverflow.com

Hello I am very new to the hibernate world and seem to have hit a roadblock. The object I need to store has a hashmap in it.

private Map<String, SentimentFrequencyCounts> modelData ...

23. My persistenceManager is null    stackoverflow.com

I have Interface which is defined as

@Local
public interface MyPersistenceManagerLocal {

  public List<PropertyList> getPropertyList(int id);

}
and implentaion class for above interface is
@Stateless
public class MyPersistenceManagerBean implements MyPersistenceManagerLocal {

  @PersistenceContext(unitName = PersistentSettings.PERSIST_NAME)
 ...

24. Update persistent object with transient object using Hibernate    stackoverflow.com

On a daily basis, data is imported via a webservice.

  1. I create a new (transient) instance of a pojo which i have mapped in hibernate via JPA annotations.
  2. I populate the data from ...

25. Hibernate to persist Dates as long    stackoverflow.com

Is there a way to tell Hibernate that java.util.Date should be persisted as long? I need this to get around the missing millisecond resolution in MySQL. Could you think of any drawbacks ...

26. Hibernate is saving a completely new entity automatically    stackoverflow.com

I am using hibernate with spring's HibernateTemplate. I have the following method.

public List<Email> findDuplicateEmails(Long profileId, List<Email> emails) {

    Profile persistedProfile = profileDao.findById(profileId);      
  ...

27. JPA @WebMethod Return Column contents in Array    stackoverflow.com

I want to return the full contents of a column from a SQL database in a Stateless session bean as a SOAP Web Service. This is my Method:

@WebMethod (operationName = "SeeAllRecords")
public String[] ...

28. "org.apache.openjpa.persistence.PersistenceException: null" error    stackoverflow.com

I've been trying to make a simple class in Java run with JPA to no avail. Help? The title is the error I'm getting. I've been trying to make a simple class in ...

29. How to set modifiedDate on an Entity when a dependent property changes    stackoverflow.com

Assume the JPA-Entity Foo. By adding annotations, i can handle updating the createdDate and modifiedDate properties. After changing name and persisting Foo, createdDate is updated correctly. But this does not work ...

30. Getting wrong data type error when persisting long as a byte array    stackoverflow.com

I am creating a hibernate usertype to persist a long datatype as a byte array with additional data in the database(hsqldb). When I set the byte array in the prepared statement(.setBytes()) ...

31. persisting timestamp type only date without time    stackoverflow.com

In my database I want save only data without time. If I use Calendar or Date type I can write:

@Column(name = "CDATE")
@Temporal(TemporalType.DATE)
Calendar cDate; // or Date cDate
but if I want use Timestamp ...

32. Equals for persistent objects    stackoverflow.com

There is well known problem with implementing equals() (and hashCode(), i will speak about equals() only) for persistance object with database managed id. New object is not stored in database, therefore does ...

33. Does Setting A persistent Object To NULL Removes It In Hibernate    stackoverflow.com

Consider this example: (User is a class with two fields: a generated id and username)

User user = new User();
user.setUserName("username");

SessionFactory sessionfactory = new Configuration().configure().buildSessionFactory();
Session session = sessionfactory.openSession();

session.beginTransaction();
session.save(user);
user = null; // Does ...

34. Limited size of string in JPA    stackoverflow.com

I have a table "message" in MySQL which contains the column "content" of type VARCHAR(3000). I'm trying to execute the following query using JPA:

@PersistenceContext(unitName="Course7-ejbPU")
protected EntityManager manager;
(...)
manager.createQuery("SELECT m.content FROM Message m WHERE ...

35. javax.persistence.EntityNotFoundException: deleted entity passed to persist: [com.disney.zeus.client.entity.MaterialAudioChannel#]    stackoverflow.com

i have a problem while deleting the child entities, this is giving me the below exception javax.persistence.EntityNotFoundException: deleted entity passed to persist: [com.myproj.test.entity.XYZ#]. parent Entity :

...

public class ABC implements java.io.Serializable {

...

 // it ...

36. Hibernate loses precision when persisting util.Date as timestamp    coderanch.com

I find it happening randomly and much more often than not. I have a simple Hibernate mapped object that has a util.Date as one of the properties. I set this Date whenever I create the object and then just persist it using Hibernate. The target property in the SQL Server 2000 DB is of type datetime. After the inserts, I can ...

37. How JPA persist a boolean    coderanch.com

My question is a quite simple mapping question. I have an oracle database and i'm using toplink as jpa implementation. I want to persist a pojo that contains a boolean. In fact the toplink dialect will create NUMBER column with two possible values 1 or 0. But is there a standard way to force a different representation like the @Temporal(TemporalType.DATE) or ...

38. OutOfMemory persisting byte[] into blob    forum.hibernate.org

I am trying to persist a set of object containing a byte[]. The entities are very simple and I am just looping over a fixed number of these and persist each of them. However shortly into this process I get an OutOfMemory error. It seems that the problem is with hibernate trying to keep a reference to the byte[] beyond the ...

39. Persisting Transient Objects Representing Existing Entities    forum.hibernate.org

Using Hibernate 3 and JPA, I am attempting to merge a transient Java object with an existing entity, but I am getting a StaleObjectStateException. Imagine for example an Employee entity: Code: @Entity @Table(name = "EMPLOYEE") public class Employee { . . . @Id @Column(name = "ID") @GeneratedValue(strategy = GenerationType.SEQUENCE) ...

40. Transitive persistence foreigen cannot be null error    forum.hibernate.org

Hi, I'm running into a foreign key cannot be null error trying to persist an entity using merge. The reason is that the containing entity is inserted before the referenced entity. If I remove the not null restraint from the column, everything works. But according to the manual that should not be necessary. I'm wondering if I'm doing something wrong here. ...

41. Data Trunctation Problem Persisting MYSQL Enum    forum.hibernate.org

I have a java enum that I need to persist in the database. We are using MYSQL 5.0. I have several times done this and I have a class, the well-known StringEnumUserType, which I took from the Caveat Emptor sample application, that I am using for this purpose. It's never given me trouble before, but now it's failing, with Caused by: ...

42. Help me with run-time built JavaBean persistence    forum.hibernate.org

I have to import a series of records from a file input. The schema of the data is only known during run-time. DynaBeans are dropped long time ago (https://forums.hibernate.org/viewtopic.php?t=937247), so let's say I build up a JavaBean dynamically from the data run-time. How can I persist that? Hibernate documentation's chapter 4.4 on Dynamic models only talks about Hash property collections (http://docs.jboss.org/hibernate/core/3.3/reference/en/html/persistent-classes.html#persistent-classes-dynamicmodels), ...

43. Persisting HashMap with usertype values    forum.hibernate.org

44. Hibernate subtracting an hour when persisting Joda DateTime    forum.hibernate.org

Hi, I'm using a Joda DateTime as a property in a domain bean. When Hibernate is persisting the bean, the hour of the DateTime property is subtracted 1 or 2 hours, as can be seen in the Hibernate debug log: Quote: Hibernate: call identity() 2011-03-17 09:59:15,721 DEBUG [HibernateTransactionManager] Found thread-bound Session [org.hibernate.impl.SessionImpl@508be] for Hibernate transaction 2011-03-17 09:59:15,724 DEBUG [HibernateTransactionManager] Participating in ...

45. HashMap persistence    forum.hibernate.org

47. Persisting transient objects.    forum.hibernate.org

Hello. I'm having a basic problem. Maybe this problem relies on how my application uses hibernate 2.1 with Tomcat 5.0.16. I'm developing a simple WEB application that interacts with database throw hibernate framework. So, supose the following scenario: User at page ShowUserInformation.jsp clicks on button delete, which sends the user to another JSP (say, UserDelete.jsp) page that receives use userId as ...

48. How to persist a Null Object    forum.hibernate.org

Hi , I am using the Null Object pattern (http://www.refactoring.com/catalog/introduceNullObject.html) in my model. I have a superclass A , and a null object N which is a subclass of A. I have a situation where A is mapped to TABLE_A , and the discriminator column is TYPE. Because N is a null object , I would not want it to be ...

49. persisting booleans in 2.1.2 (and 3) MySQL true=1, false=0    forum.hibernate.org

12:41:58,666 INFO SettingsFactory:102 - Use scrollable result sets: true 12:41:58,676 INFO SettingsFactory:105 - Use JDBC3 getGeneratedKeys(): false 12:41:58,676 INFO SettingsFactory:108 - Optimize cache for minimal puts: false 12:41:58,676 INFO SettingsFactory:114 - echoing all SQL to stdout 12:41:58,676 INFO SettingsFactory:117 - Query language substitutions: {true=1, false=0} 12:41:58,676 INFO SettingsFactory:128 - cache provider: net.sf.ehcache.hibernate.Provider 12:41:58,696 INFO ...

50. Use of HashMap v/s private variables in Persistent classes    forum.hibernate.org

Though this is more of a design question I wanted the reccomedation. I can design persistent class in 2 ways: 1. Have private attributes similar to the Java bean convention 2. Have a HashMap and write suitable getter and setter methods that put or get from the map. The advantage that I see is as follows: 1. Development time - Would ...

51. How to persist enums    forum.hibernate.org

I'm trying to find out how to persist enums to a table. As I have seen in dirrerent tutorials those enum records are static final variables of a usertype enum class. This data is not stored in any database table. I'd like my application to be able to add more records to this class on-the-fy. Solutions presented in tutorials would require ...

52. Persisting a collection of Strings    forum.hibernate.org

I'm using XDoclet to to mark up my classes for hibernate. I'm trying to persist a java.util.Colleection of java.lang.String. The documentation suggest that primitive types are automatically persisted. However using the following code breaks and I cannot find any documentation or examples of how to do this. If I change the class="java.lang.String" to one of my other persistable classes all works ...

53. persisting boolean problem    forum.hibernate.org

hi all, I'm having a problem persisting a java.lang.Boolean to a mysql database. Hibernate seems to try to perist this as either 't' or 'f' which mysql ignores. I'm using mysql 4 and hibernate 2. The mapping is as follows : Code:

54. Can we persist into SQL3 ARRAY type?    forum.hibernate.org

For example, in Postgresql, we can create table like this (notice the ARRAY type of column "a"): CREATE TABLE tt (a int[ ], b int); Then we can insert data (including an int array) like this: INSERT INTO tt (a, b) VALUES ('{1, 2, 3}', 50); When selecting data, we can see: test=# SELECT * from tt; {1,2,3} | 50 Now ...

55. alternative to persistent enum types    forum.hibernate.org

56. Making copy of persistent object    forum.hibernate.org

How can I make a copy of an existing data object, changing only the PK value? For example, Class A { Long id; //is PK String value; ...... } This is essentially what I want, but it obviously doesn't work because of the way Hibernate's sessions work. Hibernate identifies the object as already existing in the session cache, and doesn't like ...

57. Persistent enum types    forum.hibernate.org

I'm using Hibernate 2.1.4 and want to save Enumeration like this: Code: public class Side implements Serializable { public static final Side INTRUDER = new Side("INTRUDER"); public static final Side GUARD = new Side("GUARD"); public static final Side NEUTRAL = new Side("NEUTRAL"); private String myName; ...

58. Persisting jdk1.5 enums today    forum.hibernate.org

Hibernate version:2.1 I am writing a lot of jdk1.5 enums and I am wondering how to persist these enums here on the brink of the Hibernate 3 release. I have a lot of classes similar to public enum Fruit { APPLE, ORANGE, BANANA; } And I would like to persist relationships to such enums in the database. Since a jdk1.5 enum ...

59. Updating a persistent object (Date-Property)    forum.hibernate.org

Hibernate version: 2.1.6 Mapping documents: Code between sessionFactory.openSession() and session.close(): UserSession _session = getSession(pRequest); _session.setLastAccess(new Date()); _session.setIP(pRequest.getRemoteAddr()); try { mySession.saveOrUpdate(_session); } catch (HibernateException e) { e.printStackTrace(); } Full stack trace ...

60. Null values for Boolean becomes false when persisted    forum.hibernate.org

I have a problem with Boolean properties and null values in these. I want them to remain as null when the class is persisted. What happens now is that they get persisted as "false", which is definitly not what I intended. Anybody had this problem. I am using SQLAnywhere 6.4 as database and the Boolean is mapped to tinyint, which supports ...

61. persisting null instad of actual object value    forum.hibernate.org

Author Message jhudson8 Post subject: persisting null instad of actual object value Posted: Sat Oct 02, 2004 2:44 am Beginner Joined: Mon May 24, 2004 7:39 pm Posts: 37 Location: Charlotte Hello, I have a table with a required field (submitter_name) and I am trying to save an object which has that property populated. I receive an error because ...

62. Using persistent Typesafe Enum in many-to-many rel    forum.hibernate.org

Details below. I'm trying to use a persistent enum (cf: http://hibernate.org/203.html ) as part of a many-to-many relation. Please review my configuration mapping below. My assumption (correct me if I'm wrong) is that if i declare a class-entry for a PersistentEnum, then there will be a round-trip to the database to query it. I'd like to avoid that. The scenario I ...

63. Update of a persistent object with a transient object    forum.hibernate.org

Dear Hibernate community members, I am new to the hibernate community and I have an important question. I want to update a persistent object with a transient object. I have saved in a DB with hyperjaxb and hibernate from Xml file an object A1 with its attributs a1, a2; other attributes a3, a4 and link to object B1 are not filled. ...

64. Large Strings truncated on persist w/ MySQL    forum.hibernate.org

How large can a String be when persisting? I have it mapped as BUT I can only persist/load up to size 65.535, the rest is truncated. I am using MySQL as DB. Is this a limitation of MySQL or hibernate? How can I work around it? I really would like to store large XML documents with ...

65. Persisting a hashmap, basic problem    forum.hibernate.org

Newbie Joined: Wed Apr 06, 2005 3:42 am Posts: 5 Location: Berlin Hello, as a hibernate-newbie (using hibernate 3.0 final), I'm having major problems storing a HashMap in the database. After searching the forums, and finding multiple posts related to HashMaps, I figured that I can solve this myself, but after browsing the documentatin, the forum, the wiki, and the faq's ...

66. Persist transient instances question    forum.hibernate.org

hi folks, i'm a beginner with hibernate and i've got the following problem/question on persisting transient object references: part of my model consists of a simple many-to-many relationship between two Classes User and Group. As far as i understand hibernate the following functionality should be supported: ... User u = new User(....); Group g = new Group (...); u.addGroup(g); // I'm ...

67. To copy persistent object from a database to the other.    forum.hibernate.org

Hi, Does anyone have good idea to copy persistent object between two databases? My scenario is: 1) Retrieve object from databse A by such as session.load() or query. 2) Serialize persistent object into byte stream by ObjectOutputStream. 3) Send chunk of bytes to another machine thru network. 4) Deserialize it by ObjectInputStream into persistent object. 5) Save persistent object to database ...

68. Persistent enum with referenced by multiple columns    forum.hibernate.org

Hi, I had problems with persistent enums mapped to multiple columns and I'd appreciate some help. Let me explain the context of the problem. I have to access data from a legacy db, so I cannot change the schema. It has a table for enumerations, with ID, TYPE (type of the enum, i.e. the discriminator), ITEM (the value) and DESCRIPTION. All ...

69. Persisting string array String[]    forum.hibernate.org

Hi, Quite a ridiculously simple question I am sure, I'm quite ashamed but I cannot find this in all 3 of my Hibernate books or google or these forums. How do I go about mapping the persistence of a string array; String[]? I know it looks like a List but I do need it to be a string array. Thanks in ...

70. problem by cascading save/persist of transient objects    forum.hibernate.org

Hallo, i'm new using hibernate 3.0.5 and i'm having a problem with it. i want to be sure i did understand everything well: I have an association like this [Object A]1--------->*[Object B]1--------->*[Object C] B has a foreign-key to A's primary-key, C has a foreign-key B's primary-key. all primary-keys are generated now i've created an instance of A, added at least one ...

71.  transitive persistence    forum.hibernate.org

Author Message marc210 Post subject: transitive persistence Posted: Tue Oct 18, 2005 10:32 am Newbie Joined: Tue Oct 18, 2005 10:14 am Posts: 1 Hello all - I'm trying to persist/update an object to the DB. This object has two collections in it (the array elements seen below in the mapping). When I save() or persist(), everything works ...

72. Going crazy trying to persist enums...    forum.hibernate.org

The reason that a column mapping isn't needed is because the value of column has a default: the value of name. You'll need to post classes and exceptions if we're going to help debug this for you. The code on 272.html does work, or at least it did when I copied it.

73. Hibernate XML persistence - how to store date through xml    forum.hibernate.org

Hi, I am trying to store date through xml using hibernate xml persistence. But i am getting following error - org.hibernate.HibernateException: could not parse XML at org.hibernate.type.DateType.fromStringValue(DateType.java:95) at org.hibernate.type.NullableType.fromXMLString(NullableType.java:102) at org.hibernate.type.NullableType.fromXMLNode(NullableType.java:126) at org.hibernate.property.Dom4jAccessor$ElementGetter.get(Dom4jAccessor.java:192) at org.hibernate.tuple.AbstractTuplizer.getPropertyValues(AbstractTuplizer.java:174) at org.hibernate.persister.entity.BasicEntityPersister.getPropertyValues(BasicEntityPersister.java:2929) at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:84) at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730) at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:329) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86) at updatedb.DBUploder.uploadDB(DBUploder.java:77) at updatedb.DBUploder.main(DBUploder.java:219) Caused by: java.text.ParseException: Unparseable date: "20 ...

74. Effect of cascade="save" on transient/persistent    forum.hibernate.org

76. make persistent objects transient without closing the sessio    forum.hibernate.org

My problem is, that I don't want the feature automatic update of changed objects. So I have to make the loaded objects transient. But I also don't want to close the session because it's creation costs too much performance. So is there a way to separate the objects from the session without closing it or to disable the automatic update for ...

77. Persisted Strings in Hibernate    forum.hibernate.org

This relates to my previous post. Are the strings automatically escaped when persisted? I'm using Postgres dialect and my strings aren't being escaped and are throwing an illegal SQL exception when characters like single quotes are used. The literals themselves aren't being surrounded by quotes - is this normal in hibernate or the postgres dialect? Is there a setting I'm missing? ...

78. how to persist serializabe to BLOB?    forum.hibernate.org

I want store a list of values into a single column as serializable object. Hibernate maps serializable to RAW in Oracle. The problems are: 1. RAW has fixed size which may consume a lot of meory if objects are small 2. RAW can store upto 2000 bytes which can not host any reasonable list of objects. If I could map serializable ...

79. Persisting a HashMap    forum.hibernate.org

I've been struggling for a while now to solve the problem of persisting a Hashmap within an object ie.: private Map myMap; private Map petMap; I've found most documentation to be misleading. For example at http://www.hibernate.org/hib_docs/annot ... ollections : @Entity public class Software { @OneToMany(mappedBy="software") @MapKey(name="codeName") public Map getVersions() { return versions; } ... } This is the ...

80. HashMap is not getting persisted    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hi friends, I want to persist a Region Object. Region Object contains a Map also. When I do the session.save(region), the data is only gets inserted for region table not for the map table. The mapping file is below. Can anyone help me on the same. Hibernate version:3.0 Mapping documents: ...

81. Xml persistence not-null empty string problem    forum.hibernate.org

Hi, I've a problem loading an object via dom4jSession with a not-null string property when the string is empty (NOTE: I have an empty string: "", not a string variable with a null value). Hibernate throws org.hibernate.PropertyValueException: not-null property references a null or transient value: hemptystring.StringContainer.string when you load the object via dom4jSession. I've set up a simple example. Here it ...

82. Getting problem while persisting BLOB datatype    forum.hibernate.org

83. Hibernate treats Transient object as persisted object?    forum.hibernate.org

Hello All, I have a problem. I have a Customer with a Bank_Address that inherites from Address Class. When I create a new customer and new bank_address transient objects. Code: Customer customer = new Customer("2", ...); customer.setBank_Address(new Bank_Address(...)); and ...

84. Using HashMap for persistence    forum.hibernate.org

85. Persisting a collection of enums using hibernate    forum.hibernate.org

Hello there, I have the requirement to persist a collection of enums using hibernate. There seems to be a raft of information on how to persist a single enum by declaring a user type and then associating genericised enums to the user type. This, I believe, is possible as the element in the mapping file can be used in an ...

86. Persisting a collection of enum using annotations    forum.hibernate.org

Hibernate version: hibernate: 3.2.3.ga hibernate-annotations: 3.2.1.ga Mapping documents: None I have an entity [User] which has a property [Subspecialty]. Subspecialty is a simple java.lang.Enum This I can persist without issue. The problem is that I need a Collection of Subspecialty. Code: @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) public Collection getSubspecialties() { ...

87. Persisting a String property separately in a lookup table    forum.hibernate.org

Newbie Joined: Tue Jul 29, 2008 5:20 pm Posts: 3 Hi everyone! I am new to Hibernate and I usually try solving things on my own. I have been searching all of Hibernate's documentation, Google, the forums, etc. I haven't been able to find a solution to my problem, even if I found out things that were close, but not close ...

88. Persisting new object saves with null id [Solved]    forum.hibernate.org

I have been very reluctant to post but this issue is bugging me and I am unable to find anyone who has encountered similar symptoms. I don't think this is a failure of understanding of how hibernate works, but I'll start with what I think is supposed to happen. I am simply trying to do an insert into a stripped down ...

90. CollectionOfElements not persisting    forum.hibernate.org

I am trying to use the @CollectionOfElements annotation to save a set of value types along with my entity. Unfortunately, the entity is persisting but the value types are not. Can someone help me figure this out? My entity class Account is shown below: Code: @Entity public class Account implements Serializable { ... ...

91. persisting a set of enums    forum.hibernate.org

Hi there, I'm trying to persist a Set of enums using JPA annotations only. Unfortunately I either get an error about the enum class not being mapped (if I annotate the set with @ManyToMany) or about Hibernate not being able to determine a type for java.util.Set (if I omit the @ManyToMany annotation). I have the feeling that Hibernate (at least 3.3.1.GA) ...

92. Can an Entity be Transient or not persisted    forum.hibernate.org

@Entity public final class AsapSession { @Id private Integer id; @OrderBy(clause = "position") @OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER) @Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DELETE_ORPHAN}) @JoinColumn(name = "sessionId", nullable = false) private List columns; }