Skip to content
Advertisement

Tag: orm

How to map a map JSON column to Java Object with JPA

We have a big table with a lot of columns. After we moved to MySQL Cluster, the table cannot be created because of: ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 14000. This includes storage overhead, check the manual. You have to change some columns to TEXT or

How to paginate a JPA Query

I have a submission table with columns like ID, Name, Code among other properties. My requirement is to search for records based on the mentioned properties and return a paginated set. This is the pseudocode for what I am looking for: There seem to be many options like CriteriaBuilder, NamedQuery, etc. Which is the most efficient one in this situation?

Hibernate faster EntityManagerFactory creation

In my desktop application new databases get opened quite often. I use Hibernate/JPA as an ORM. The problem is, creating the EntityManagerFactory is quite slow, taking about 5-6 Seconds on a fast machine. I know that the EntityManagerFactory is supposed to be heavyweight but this is just too slow for a desktop application where the user expects the new database

hibernate or oracle support for timelines?

We have a requirement for persisting, using Hibernate, versioned Java objects into an Oracle database such that each version has a valid-from and valid-until timestamp. This is so we can query for objects as-at a specific time. Does Hibernate or Oracle 11g (or anything else) provide anything that would simplify this? Answer Have a look at Hibernate Envers The Envers

How to use object oriented programming with Hibernate?

While using ORM tools such as Hibernate, I’ve found it is advantageous to keep all business logic out of my business objects and instead keep it in a service layer. The service layer creates the business object POJOs, manipulates them, and uses DAOs to save them. But isn’t this in a way taking a step backwards from the object oriented

How to specify SQL comments through JPA annotations?

Is there any way to specify SQL comments through JPA annotations? Comments for tables and columns. Answer Is there any way to specify SQL comments through JPA annotations? Comments for tables and columns. No. If you want to define tables and columns comments, your best option is to do it after the facts in the generated DDL, before executing it

Hibernate : dynamic-update dynamic-insert – Performance Effects

Using dynamic-update or dynamic-insert has positive, though generally slight only on performance, as also mentioned by http://www.mkyong.com/hibernate/hibernate-dynamic-update-attribute-example/ But the reference documentation mentions that this could have negative performance effects also as mentioned below in http://docs.jboss.org/hibernate/core/3.3/reference/en/html/mapping.html#mapping-declaration-class : Although these settings can increase performance in some cases, they can actually decrease performance in others. Can anybody please suggest some example/scenario mentioning negative

Difference between FetchType LAZY and EAGER in Java Persistence API?

What is the difference between FetchType.LAZY and FetchType.EAGER in Java Persistence API? Answer Sometimes you have two entities and there’s a relationship between them. For example, you might have an entity called University and another entity called Student and a University might have many Students: The University entity might have some basic properties such as id, name, address, etc. as

Advertisement