hibernate

Java Frameworks that support Entity-Attribute-Value Models

I am interested in developing a portal-based application that works with EAV models and would like to know if there are any Java frameworks that aid in this type of development? salesforce.com uses EAV and currently has twenty tables. The framework I seek should allow it to be configurable to different EAV implementations ...

testing dao with hibernate genericdao pattern with spring.Headache

Hello good fellas! in my journey of learning hibernate i came across an article on hibernate site. i' learning spring too and wanted to do certain things to discover the flexibility of spring by letting you implement you own session.yes i don't want to use the hibernateTemplate(for experiment). and i'm now having a problem and even the t...

Hibernate @OneToMany with mappedBy (parent-child) relationship and cache problem

Hi, everybody. I have this problem for a long time now, I have searched the web and SO in and out and didn't find a solution yet. I hope you can help me on that. I have a parent-child relationship between two entities like the following: @Entity public class Parent { // ... @OneToMany(mappedBy = "parent", fetch = FetchType.LA...

Hibernate/Spring3: could not initialize proxy - no Session

Hi guys, I'm new at Spring, so I put Spring 3.0M3 on a Tomcat server on my Mac, made an Eclipse project, completed a Hello World and then wanted to make an object persist with Hibernate. I've made a User table on my MySQL server, made a User object with all getters and setters (I really wish Java would take a queue from Objective-C here ...

Automatically apply field conversion function in Hibernate

I have a database table with a field that I need to read from and write to via Hibernate. It is string field, but the contents are encrypted. And for various reasons (e.g. a need to sort the plain text values), the encrypt/decrypt functions are implemented inside the database, not in Java. The problem I'm struggling with now is finding ...

How do I prevent JPA inserts from locking a database table?

I'm using Hibernate backed JPA as my persistence layer. I have a multi-threaded process that aggregates data from a Soap call and then stores a row in a database. The process usually ends up inserting about 700 rows and takes about 1 - 3 hours, with the Soap calls being the main bottleneck. During this entire process the table I am ins...

The equivalent of <generator class="native"></generator> using MySQL and Hibernate3 annotations

Starting a new project I'd like to use Hibernate annotations with MySQL instead of the configuration files I've used so far. And I can't seem to find the equivalent of: <id name="id" type="long" > <generator class="native"></generator> </id> I tried using: @Id @GeneratedValue(strategy = GenerationType.IDENTITY, generator = "nativ...

In class without a property called "type" I get org.hibernate.PropertyNotFoundException: Could not find a setter for property type in class

Using JPA, and Hibernate as the provideer, I have a class defined like: @Entity @Table(name="partyrole") public class PartyRole extends BaseDateRangeModel { private static final long serialVersionUID = 1L; private Party roleFor; public void setRoleFor(Party roleFor) { this.roleFor = roleFor; } @ManyToOne public Party g...

Grails: Adding sorting and paging to a custom HQL query

I have a list method that uses HQL. how do I add the paging and sorting parameters to this query? def list = { def termList log.info "Getting terms for product: $params.productId" params.max = 10 def p = Product.get(params.productId) if (p) { log.info "Product found: $p.name" ...

How to initialize JNDI in struts to use Java Persistence?

We have two applications a legacy struts app and and a new Seam application. We are using Hibernate and JPA on the Seam side and want to try to do so on the Struts side. I am trying to do: EntityManagerFactory emf = Persistence.createEntityManagerFactory("foo"); on the struts side, but I am seeing the following error: o...

Hibernate transaction duplicate problem

Hi every one, I want update some of my table in database and want all of these work do in 1 transaction, first of all I delete some entry in branchbuildin(Table) and Insert new one after this action The problem occurred when I insert and entry with same buildingname and branch_fk (be cause I have this constraint on this table ( uniqueCon...

Hibernate Second level Cache <<net.sf.ehcache.hibernate.EhCacheProvider>>

Hi every one, I want use second level cache in my hibernate Project but I just know a little about hibernate second level cache, can any one explain how shoud I use this in my code and what configuration and .jar file I need? I set these setting to my hibernate.cfg.xml file <property name="hibernate.cache.use_query_cache">true</propert...

Hibernate vs CFQuery

Recently CF9 released Hibernate Support. One thing that I cant grasp is the diiferences between Hibernate and CFquery. While i see that Hibernate is good for mapping out your tables to objects and then calling those objects like getTableName() etc. But say if i want to replicate this query SELECT SUM(tableVal) FROM mytable Dont i still...

Running hibernate tool annotation generation without the "catalog" attribute

when i run my hibernate tools it reads from the db and create java classes for each tables, and a java class for composite primary keys. that's great. the problem is this line @Table(name="tst_feature" ,catalog="tstdb" ) while the table name is required, the "catalog" attribute is not required. sometimes i want to use "tstdb", so...

Hibernate Object Identity Question

In java persistence with hibernate, gavin suggests that we use business key for equality comparison. Business keys can not only involve multiple field comparisons, but there is no guarantee that the "perfect" business key's semantics will not change in future. We live in non ideal world and business requirements and laws change very freq...

How to achieve "not in" by using Restrictions and criteria in Hibernate?

I have list of category. I need a list of category by excluding 2,3 row. Can we achieve through hibernate by using Criteria and Restriction? ...

Mapping a ManyToMany across join/link table using 3 ID Fields

Is it possible to use a @ManyToMany mapping across a join using 3 PK columns? I'm fairly certain this is not possible and the solution is to expose the entity using @OneToMany which I have done in the past, but because this field is simply a PK I thought there maybe some clever mapping to save me this work. Regards a Hopeful - JamesC ...

Bulk inserts with Spring / Hibernate

Hello, I'm using in my application a mix Spring/Hibernate (nothing original). For a given feature, I have to import the content of a CSV file into a table of my Oracle DB. For now, I juste create the objects, I do HibernateTemplate.saveOrUpdate on each of them (I need to retrieve their newly allocated Id) Then the transaction occ...

Sharing JMS and Hibernate transactions in a Spring MDB using Oracle Streams AQ?

I'm using Oracle 11g for my database and its Oracle Streams AQ feature as JMS implementation. For all I know, it should be possible to implement a Spring based message-driven POJO (MDP) that uses the same data source for both transactional data access and JMS transactions -- all without XA-Transactions (IIRC, this was marketed as a feat...

Hibernate Oracle and Character Encoding

Im having an issue at the moment where my testing environment is not persisting the trademark character "™" in the database. When I enter in the form data, then submit it, I can see that on the server side, the request has the correctly encoded ™ character, but then when the call to hibernate's "saveOrUpdate()" method is called, the data...