Entity « Data Type « JPA Q&A





1. Ehcache / Hibernate and RMI replication with large number of entities    stackoverflow.com

I'm currently investigating how to use the RMI distribution option in ehcache. I've configured properly ehcache.xml and replication seems to work fine. However I've 2 questions: -> It seems ehcache/ hibernate ...

2. Oracle converts empty string to null but JPA doesn't update entity cache correspondingly    stackoverflow.com

It's a well known fact, that Oracle treats empty strings as null. However, I'm having an issue because of this behaviour due to JPA's caching. First I persist using JPA (Toplink Essentials) an ...

3. How should I use Enums in Openjpa entities?    stackoverflow.com

I'm trying to use an enum field in an openjpa entiy. Everything works fine unitl I try to enhance my entities which breaks with a ClassNotFound exception for the Enum type. ...

4. cannot get clob datatype from database into JPA entity    stackoverflow.com

I able to save (spring-hibernate saveorupdate()) field

 @Lob
 @Column(name = "FILENAME")
 private String filename;
into oracle database datatype is clob but when i try retrieve it, i get error
ERROR ...

5. Number of times an entity is viewed    stackoverflow.com

  1. How do you track the number of times a particular entity (say a user profile much similar to stackoverflow.com) is viewed by other users? Would it make sense to update this ...

6. Should I write equals() methods in JPA entities?    stackoverflow.com

I want to check if entity is in a Collection member (@OneToMany or @ManyToMany) of another entity:

if (entity2.getEntities1().contains(entity1)) { }

7. How to get hibernate to return entity even if entity doesn't exist in database    stackoverflow.com

Ok, im not sure how to put this. But here goes. say i have a database with the tables movie and user_movie, movie holds information on any given movie, and user_movie holds ...

8. How to write java.sql.Blob to JPA entity?    stackoverflow.com

I have a JPA entity with java.sql.Blob:

@Entity
public class LargeData {

  @Lob
  private java.sql.Blob data;

  //getters/setters
}
How to create instance of this entity? I want to set Blob with setData() ...

9. Updating JPA entity fails on null value    stackoverflow.com

I am using JPA (Hibernate) to store an entity on a MySQL 5.0 server. Here is the entity in simplified form:

@Entity
@Table(name = "messages")
public class Message implements Serializable
{
    @Id
  ...





10. Create the perfect JPA entity    stackoverflow.com

I've been working with JPA (implementation Hibernate) for some time know and each time I need to create entities I find myself struggling with issues as AccessType, immutable properties, equals/hashCode, ... ...

11. JPA entity: get the hours,minutes and sec from Oracle DATE column    stackoverflow.com

I have problems to get the full DATE info from my Oracle DB (dd/mm/yyyy hh/mm/ss). In the db level, in the column that I want to receive I set test values:

update my_table
set ...

12. What is the equivalent for Hibenate.saveOrUpdate() in entity framework    stackoverflow.com

In entity framework you have to write a lot of code for saving or updating a single entity:

 using (DataContext context = new DataContext())
    {
    ...

13. Get revision numbers of root entity and their entities in collections    stackoverflow.com

At the moment I am experimenting with the envers library in our application for integration. Whenever I do an getRevisions I only get the revisions for the root entity. However I ...

14. JPA entities and equals method on abstract entity    stackoverflow.com

I have a abstract entity class that 3 slightly different entities implements. In my 3 sub classes I have overriden the equals and has methods but the question is, should I ...

15. hibernate entity a.equals(b) but a != b    coderanch.com

Does hibernate allow the more than one entity node to represent the same corresponding record in the database (in the same JVM application instance)? I suspect it would not allow that because it would allow a number of inconsistent and unequal nodes to exist. If updated, which one would be persisted? Consequently, to test whether node A represents the same instance ...

16. How to insert enum type entity in MySQL with JPA    coderanch.com

Hi All, I would like to find out how to use entityManager.persist() in JPA to insert enum type object with its descriptive name as opposed to the index / positional number. For instance, we have the following enum type: public enum Color { Blue, Red, Yellow, Green, White, Black }; The data inserted into MySQL is 0, 1, 2, 3, 4, ...





17. org.hibernate.MappingException: Unknown entity: java.lang.String<< how can i solve    coderanch.com

public class AddQuotation3Controller extends SimpleFormController{ // QuotationListDAO quotationListDAO; SelectedLayoutDAO selectedLayoutDAO; public void setSelectedLayoutDAO(SelectedLayoutDAO selectedLayoutDAO) { this.selectedLayoutDAO = selectedLayoutDAO; } // public void setQuotationListDAO(QuotationListDAO quotationListDAO) { // this.quotationListDAO = quotationListDAO; // } // public AddQuotation3Controller(){ setCommandClass(String.class); setCommandName("quotation3"); } protected ModelAndView onSubmit(Object command) throws Exception { System.out.println("onSubmit"); String value = (String) command; String detail[] = value.split(",", 7); selectedLayoutDAO.addSelectedLayout(detail); return new ModelAndView(getSuccessView()); } } ...

18. UserType is making entity dirty    forum.hibernate.org

I have a custom UserType to convert mysql timestamps in the '0000-00-00 00:00:00' format to null. The problem with using the custom UserType is it makes the entity dirty. Since it is dirty it does update statements unnecessarily. I have tried using interceptors but they don't always work. It is trying to update the record in the table when i try ...

21. Time-Slices Entities    forum.hibernate.org

We've an application that bases on 'time-sliced' object. I don't know a better expression for this but I'll explain what I mean: Let's say we have an object called Person with attributes/properties like lastname, firstname, dateofbirth, address etc. Quite common stuff. Now the difference is that we're not only interested in where the person lives at the moment but also where ...

22. MappingException: Unknown entity class: java.lang.String    forum.hibernate.org

Hi everyone. I'm a beginner, and am trying out a very simple program to understand the concepts. There's Users class, which has "username" and "pswd" columns. A UserRights table has a username column which references username in Users and a userrights column which is an integer holding a numeric value. The UserRights table also has a surrogate primary key column. I ...

23. MappingException: java.lang.String is an unknown entity    forum.hibernate.org

Newbie Joined: Fri Jan 07, 2005 3:18 pm Posts: 16 Location: Boulder, CO I am trying to create a one-to-many association -- essentially I want to have a parent object (UserErrorSettings) which contains a collection of children objects (a set of UserErrorFilterStrings). I can generate the codes with hbm2java, compile the classes, and export the schema, but when I try to ...

24. Caching entities containing Blob (but not the Blob)    forum.hibernate.org

This is a feature request. I have an entity (Picture) containing a java.sql.Blob. I'd like the entity data for my Picture to be cached in the 2nd level cache. I don't need or want the blob data itself to be cached, but I need to be able to fetch the attached entity data without a DB hit. I can't put @Cache ...

25. update object : setting null value to an ENTITY property    forum.hibernate.org

Hibernate version:2.1.7 Mapping documents: PSAC_CPT_CLIENT_RISQUE Code between sessionFactory.openSession() and session.close(): if (!form.isBlankString(form.getDateIdentification())) { c.setIdentification(sdf.parse(form.getDateIdentification())); } else { c.setIdentification(null); } ...... this.clientRisqueDao.updateObject(c); Full stack ...

26. limiting the number of columns returned from an entity    forum.hibernate.org

I have table called committee which has 10 fields By using projections on criteria queries it is possible to limit the columns returned but is it possible to do this using HQL. what i meain I don't want to specify the field names like one below from cmte.id, cmte.name committe cmte by just issuing query like "from cmte" , I would ...

27. MappingException: Unknown Entity: java.lang.String?    forum.hibernate.org

Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version: Latest - Hibernate 3.2.4.SP1 Mapping documents: User.hbm.xml: Code:

28. Can you create a Blank Transient Entity? *RESOLVED*    forum.hibernate.org

Sorry folks, I know this is bad form but, I guess this is a bit of a bump. Even if someone could post a link to a part in a manual or anything so that I can go and read it. (I can't find what I'm looking for in the official hibernate manual). Thanks again!

29. Problem inserting Entity with java.sql.Clob    forum.hibernate.org

I have been trying to insert an entity with a field mapped as java.sql.Clob, an anotated as @Lob This is the releveant part of my code for the operation Code: try { getArchivoConciliacionDao().createFlush(archivoConciliacion); } catch (EntidadNoGrabadaException e) { ...

30. Cast selectItem to Entity    forum.hibernate.org

I'm not sure if it's what you're trying to achieve, but you need to set the role as the "value" on the SelectItem using SelectItem.setValue(). When JSF informs you when SelectItem was selected, you need to grab the "value" back using SelectItem.getValue() - and that Object should cast back to your Role class OK.

31. Merge Operation and Transient Entities    forum.hibernate.org

I have a reference A to an entity C that has not been persisted. I invoke merge and obtain a reference B to the merged instance. (the Id has not been set as it is a generated Id). If I serialize and deserialize B, update an attribute and perform a merge, this does not associate itself with C (probably because no ...

32. MappingException: Unknown entity: java.lang.String    forum.hibernate.org

Newbie Joined: Wed Aug 20, 2008 3:27 am Posts: 3 Need help with Hibernate? Read this first: http://www.hibernate.org/ForumMailingli ... AskForHelp Hibernate version:3.2 Mapping documents: Code:

33. MappingException: Unknown entity: java.lang.String    forum.hibernate.org

Regular Joined: Wed Jan 28, 2009 8:31 pm Posts: 54 Hi I have a code who work on hibernate 2 But not in hibernate 3. I what to delete all row on the table Xc4dvoy. Code: public void deleteAllRows() throws HibernateException { Session session = null; try { ...