orm

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...

JPQL (JPA) search substring

Hi, Im facing simple problem with searching entities by some (sub)string, which they might contain. E.g. I have users user1, usr2, useeeer3, user4 and I will enter to search window "use" and I expect to return user1, useeer3, user4. Im sure you know what I mean now. Is there any construction in JPA (JQPL)? It would be nice to search u...

Interface between two related JPA entities

The scenario is as below (tables shown) Delivery table ------ id channelId type 10 100 fax 20 200 email Fax table ---- id number 100 1234567 101 1234598 Email table ----- id email 200 [email protected] 201 [email protected] basically a one to one relationship between the delivery and the channel entity but since each concr...

Updating in a REQUIRES_NEW then finding in a different transaction returns old data. Why?

This question is best described by a picture I think. I hope someone can help me. Thanks ...

Parent-Child relation while using object data source

Hello guys I am experiencing with a class generator I've written, which generates a class for each table in database with each table field as a property and such. Before that, I used to add a typed dataset to the project and add some tables to it. It automatically detected the relationship between tables and when I added a parent table a...

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...

Coldbox Security Interceptor

Hi I am new to coldbox and working on a guestbook messaging forum. does anyone know how I can apply some rule in coldbox to show edit and delete for specified users of admin or user in the edit page. I am not sure how to specify this as I already have my rules here as shown in securityRules.xml: SecurityRules.XML ehSecurity\.dspLo...

Map enum in JPA with fixed values ?

I'm looking for the different ways to map an enum using JPA. I especially want to set the integer value of each enum entry and to save only the integer value. @Entity @Table(name = "AUTHORITY_") public class Authority implements Serializable { public enum Right { READ(100), WRITE(200), EDITOR (300); private int value; ...

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...

JPA returning null for deleted items from a set

This may be related to my question from a few days ago, but I'm not even sure how to explain this part. (It's an entirely different parent-child relationship.) In my interface, I have a set of attributes (Attribute) and valid values (ValidValue) for each one in a one-to-many relationship. In the Spring MVC frontend, I have a page for an...

using JDBC with persistence.xml

I am building a framework that manage the access to the database. the framework getting tasks from the user and handle a connection pooling that manage the access to the database. the user just send me SQL commands. One of the feature that i would like to support is working with JPA, in this case i will provide entity manager. in some ...

Problem trying to achieve a join using the `comments` contrib in Django

Hi, Django rookie here. I have this model, comments are managed with the django_comments contrib: class Fortune(models.Model): author = models.CharField(max_length=45, blank=False) title = models.CharField(max_length=200, blank=False) slug = models.SlugField(_('slug'), db_index=True, max_length=255, unique_for_date='pub_dat...

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...

Entity Framework v4 examples and tutorials of conceptual model mapping

In an application I'm writing I have a fairly complicated Database model. I'd like to use EF4 to map this to a whole lot nicer conceptual model. However all the tutorials I've read are with samples of 2 or 3 tables which all map 1 on 1 to the conceptual model. I'd like to learn how to correctly map the database model to a different con...

Need a workaround to filter on related model and aggregated fields in Django

I opened a ticket for this problem. In a nutshell here is my model: class Plan(models.Model): cap = models.IntegerField() class Phone(models.Model): plan = models.ForeignKey(Plan, related_name='phones') class Call(models.Model): phone = models.ForeignKey(Phone, related_name='calls') cost = models.IntegerField() I want to run a ...

Would an ORM have any way of determining that a SQLite column contains date-times or booleans?

I've been thinking about using SQLite for my next project, but I'm concerned that it seems to lack proper datetime and bit data types. If I use DbLinq (or some other ORM) to generate C# classes, will the data types of the properties be "dumbed down"? Will date-time data be placed in properties of type string or double? Will boolean data...

How yield implements the pattern of lazy loading?

How yield implements the pattern of lazy loading? ...