hibernate

error : java.lang.String cannot be cast to coldfusion.cfc.CFCBeanProxy anyone know about this ?

Does anyone know about this error I get when I try to insert a foreign key value in my entry entity using ColdFusion 9 Hibernate integration? java.lang.ClassCastException: java.lang.String cannot be cast to coldfusion.cfc.CFCBeanProxy Root cause :org.hibernate.HibernateException: java.lang.ClassCastException: java.lang.String ...

Java Hibernate/C3P0 error: "Could not obtain connection metadata. An attempt by a client to checkout a Connection has timed out."

I'm trying to get some code I was passed up and running. It appears to use the Hibernate framework. I've gotten past most of the errors tweaking the configuration, but this one has me dead stumped. It's trying to connect to two databases: gameapp and gamelog. Both exist. It seems to have issues connecting to gamelog, but none connecting...

Converting SQL with subselect in select to HQL

I have the following SQL that I am having problems converting to HQL. A NPE is getting thrown -- which I think has something to do with the SUM function. Also, I'd like to sort on the subselect alias -- is this possible? SQL (subselect): SELECT q.title, q.author_id, (SELECT IFNULL(SUM(IF(vote_up=true,1,-1)), 0) FROM vote WHER...

What is the "owning side" in an ORM mapping?

I'm new to JPA. Now I have a question: what exactly does the owning side mean? I only have a rough idea of it. What is an explanation with some mapping examples (one to many, one to one, many to one)? PS: the following text is an excerpt from the description of @OneToOne in Java EE 6 documentation. You can see the concept owning side in...

Using Hibernate with Struts

How can I configure Hibernate in Struts? ...

How to handle choice field with JPA 2, Hibernate 3.5

I have an entity with Integer attributes that looks like this in proto code: class MyEntity: String name @Choices({1, "BSD", 2, "Apache", 3, "GPL"} Integer frequency @ChoicesSegment({1000, 2000, 3000}, {"BSD", "Apache", "GPL"}) Integer type String getFrequency() return getChoice("frequency", frequen...

Hibernate Query - Get latest versions by timestamp?

I have a database that is being used as a sort of version control system. That is, instead of ever updating any rows, I add a new row with the same information. Each row also contains a version column that is a date timestamp, so the only difference is the new row will have a more recent timestamp. What I'm having trouble with is writin...

Performance tuning of a Hibernate+Spring+MySQL project operation that stores images uploaded by user

Hi I am working on a web project that is Spring+Hibernate+MySQL based. I am stuck at a point where I have to store images uploaded by a user into the database. Although I have written some code that works well for now, but I believe that things will mess up when the project would go live. Here's my domain class that carries the image b...

Hibernate exception

Hi all, im new to hibernate! i have followed the netbeans tutorial on creating a hibernate enabled application. after sucessfully creating a database in mysql workbench i reversed engineered the pojos etc and then tried to run a simple query(from Course) and got the following org.hibernate.MappingException: An association from the table...

In JPA, a Map of embeddable values, that have an embedded entity used as the key

I'm still new to JPA (and Hibernate, which I'm using as my provider), so maybe this just can't be done, but anyway... Consider the following code: @Entity class Root { @Id private long id; private String name; @ElementCollection private Map<ResourceType, Resource> resources; ... } @Entity class ResourceType { ...

JPA and compatibility with persistance providers and databases vendors

JPA promises to be vendor neutral for persistence and database. But I already know than some persistence frameworks like hibernate are not perfect (character encoding, null comparison) and you need to adapt your schema for each database. Because there is two layers (the persistence framework and database), I would imagine they're some wo...

Hibernate mapping to object that already exists

I have two classes, ServiceType and ServiceRequest. Every ServiceRequest must specify what kind of ServiceType it is. All ServiceType's are predefined in the database, and ServiceRequest is created at runtime by the client. Here are my .hbm files: <hibernate-mapping> <class dynamic-insert="false" dynamic-update="false" mutable="true"...

Hibernate HQL and Grails- How do I compare collections?

Hi everyone (my first post!), I have an HQL question (in Groovy/Grails) I was hoping someone could help me with. I have a simple Asset object with a one-to-many Tags collection. class Asset { Set tags static hasMany = [tags:Tag] } class Tag { String name } What I'm trying to do in HQL: A user passes in some tags in params...

how to measure hibernate performance?

how to measure performance in hibernate? I want to know that how much time hibernate takes to execute a query? ...

does anybody knows that eclipse Testing and Performance Tools Platform works with hibernate application?

does anybody knows that eclipse Testing and Performance Tools Platform works with hibernate application? ...

how can i display the database data to an jtable(dynamic) in the swings!

we are using hibernate in business layer,but the task is, by using the jtable in swings to display the dynamic data(swings) from the database. code: Criteria criteria=session.createCriteria(User.class); //here user.class is pojo class in hibernate. List studentlist= criteria.list(); System.out.println("records"+studentlist); here t...

PropertyPlaceholderConfigurer vs Filters -- Spring Beans

Hi there. I've got a question regarding the difference between PropertyPlaceholderConfigurer (org.springframework.beans.factory.config.PropertyPlaceholderConfigurer) and normal filters defined in my pom.xml. I've been looking at examples, and it seems that even though filters are defined and marked to be active by default in the pom.xm...

How to set up jndi.properties for DataStore?

I'm struggling to set connect a Java program to MySQL using JPA/Hibernate. I'm currently getting the following error when I try to call createEntityManagerFactory(): [main] ERROR org.hibernate.connection.DatasourceConnectionProvider - Could not find datasource: java:jdbc/myDataDS javax.naming.NoInitialContextException: Need to specify ...

Integration testing - Hibernate & DbUnit

Hi, I'm writing some integrations tests in JUnit. What happens here is that when i run all the tests together in a row (and not separately), the data persisted in the database always changes and the tests find unexpected data (inserted by the previous test) during their execution. I was thinking to use DbUnit, but i wonder if it resets...

JPA persistence.xml share same jar file

Hi! I'm wondering if I can share the same jar file for several persistence units.. I mean: I have two persistence units described in my persistence.xml file and the entities are not in the same JAR. Entities are in a separated JAR file but, in that one, there are entites for both persistence units. I think I red somewhere that I coould u...