Persist « Field « JPA Q&A





1. JPA fastest way to ignore a field during persistence?    stackoverflow.com

I'm essentially looking for a "@Ignore" type annotation with which I can stop a particular field from being persisted. How can this be achieved?

2. JPA set TIMESTAMP field to CURRENT_TIMESTAMP when persisting    stackoverflow.com

I have a TIMESTAMP column on a table that is set to null when a record is initially inserted. I would like to update the value to the current time. ...

3. Persist collection fields with hibernate    stackoverflow.com

Using hibernate, how can I persist a class with a List<String> field? Consider the following entity class:

@Entity
public class Blog {
    private Long id;
    private List<String> list;

 ...

4. How to persist an entity which contains a field of user type using JPA2    stackoverflow.com

I'm looking for a way to persist an entity which contains a field of a user type. In this particular example I would like to persist the ts field as number ...

5. JPA and unique fields    stackoverflow.com

I have two persistence objects in my app: Things and tags attached to things. The app can generate collections of things with tags attached. Tag objects have a unique name (it ...

6. JPA: how do I persist a String into a database field, type MYSQL Text    stackoverflow.com

The requirement is that the user can write an article, therefore I choose type Text for the content field inside mysql database. How can I convert Java String into MySQL Text Here ...

7. How to persist an object that has an enumeration field    stackoverflow.com

I'm using an enumeration in my domain model, but I get the following error when I try to persist an object to the database:

Exception in thread "main" java.lang.ClassCastException: nl.ru.cmbi.pdbeter.core.model.enums.Enum_WhifFunction cannot be ...

8. Hibernate - How to persist an entity but disregarding certain fields?    stackoverflow.com

I have an Entity with several fields:

@Entity
public class Leilighet {
@Id @GeneratedValue(strategy = GenerationType.AUTO)
private Long leilighetId;
private String navn;
private String beskrivelse;
private String adresse;
private String postNr;
private String postSted;
private double pris;

//The following fields should not ...

9. How to tell JPA to use a field of a simple class as the persistence value?    stackoverflow.com

Consider this class:

@Entity
class Bar {
    @Id
    private long id;
    private FooId fooId;
    /* ... */
}
Where Foo is basically just:
class ...





10. Persisting JPA entities with entity fields possible?    stackoverflow.com

If I have an entity such as the following:

@Entity
public class Customer {
    private Address address;
}
And the Address is also an entity:
@Entity
public class Address {...}
Does persisting the Customer in ...

11. Non persistent class with persistent fields    forum.hibernate.org

I have following database design: A Project has multiple Categories : stored in ProjectCategory table with ProjectId as one column A Project has multiple Types: stored in ProjectType table with ProjectId as one column A Project has multiple Locations: stored in ProjectLocation table with ProjectId as one column The Project will have other properties associated with it in Project table. Now ...

12. Problem persisting to a table that contains a blob field    forum.hibernate.org

Hi all, I've been having a problem trying to persist an object that maps an object to a table that contains a blob field. I read this link http://www.hibernate.org/73.html and created the BinaryBlobType and the mapping as directed and I'm still having problems. I also tried one of the solutions from the page, which was to change the batch_size to 0, ...

13. Newbie question: getting some fields back from a persisted o    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: 3.x Mapping documents:

14. Clobs in same table persisting in wrong DB fields    forum.hibernate.org

I am using hibernate 3.0 with an Oracle database. I have a document table that has 3 CLOBs. One called "document", another called "history" and a third called "formattedText". On occassion, when I persist the document object, the value that is in the document property is persisted in the history field and vice-versa. I've put checks in the object's setter and ...

15. non persistent field    forum.hibernate.org

16. How can I persist the order of a collection in a DB field?    forum.hibernate.org

Hello All, Im using Hibernate 3 with a legacy application on an oracle9i database. We are persisting data that has a field named "node order." The data represents a hierarchy tree (similar a file tree like windows explorer). I would like to create a SortedSet of 3 items and have their order persisted. For example, Id like the application to persist. ...





17. Persist one-to-one field object    forum.hibernate.org

class Order { Lond id; Date ts; double amount; State state; // getters and setters... } class State { Long id; String desc; int qty; ... ...

18. Not persisting all fields of an object.    forum.hibernate.org

Hello, I am currently working on a Hibernate system. I have an object that stores the password of a client. However this objet also stores the email address of this client. My problem is that each time the user changes his email he has to change the password. If he leaves the password empty, it will ba saved as an empty ...

19. Need to persist a field that was previously derived    forum.hibernate.org

Hi, I have a contract domain object. The contract object contains SETs of contract Line items and other various properties that my app uses. At present, calculating the contract cost is done via a call to a getTotalContractCost() method. This is transient method. The method checks the dependent objects as necessary. This works well. Now the users want to store the ...

20. Insert images into Blob fields using Hibernate & Persist    forum.hibernate.org

am a little confused on how to insert images into blob fields in database. In the entity class should the field be of type Blob? for example: @Entity @Table (name = "images") public class Pic { @Id @Column(name = "name") private String name; @Column (name= "picture") private Blob picture; I am not sure how to go about it. please provide suggestions ...

21. How to Persist an object in different tables based on field    forum.hibernate.org

I have an object Property and it has fields like private City city; private TransactionType transaction_type; For some cities and transaction_types I want to store them in different tables (to optimize queries - not sure if its the correct approach). 1)How can it be done? 2)I am not sure if storing in different tables after checking the values of fields is ...

22. VERY weird - Hibernate persisting all fields when shouldnt    forum.hibernate.org

@Test public void testPostNewJob() { setCurrentUser( new EmployerUser() ); Job job = new Job(); job.setPositionName( "name" ); job.setDescription( "description" ); job.setExcerpt( "exerpt" ); ...