orm

Selecting specific columns in jpa 2 Criteria API?

Is there a way to select specific column using the JPA 2 Criteria API? The following is the target SQL Statement: SELECT column1, column2 FROM MyTableThatHasMultipleColumns With Hibernate's Criteria API this can be done using Projections, is there an equivalent to the JPA 2 Criteria Specification? ...

CriteriaQuery with JPA 1.0

Hello, Is it possible to use CriteriaQuery with JPA 1.0. I guess JPA 2.0 not available with Java Se ( version -- Java(TM) SE Runtime Environment (build 1.6.0_16-b01)) . I tied to use, CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery<Test> cq = cb.createQuery(Test.class); Root<Test> test= cq.from(Test.class); .... But cou...

django orm and 3 relations

Hi, I have a problem to transpose my sql request in the orm. Well, this my sql request : SELECT DISTINCT accommodation.id from accommodation LEFT JOIN product on product.accommodation_id=accommodation.id LEFT JOIN date on date.product_id = product.id WHERE date.begin> '2010-08-13'; So i want all the accommodations for a period, wit...

Python ORM that automatically creates classes from DB schema

Hi, is there a python ORM (object relational mapper) that has a tool for automatically creating python classes (as code so I can expand them) from a given database schema? I'm frequently faced with small tasks involving different databases (like importing/exporting from various sources etc.) and I thought python together with the above...

Hibernate version?

I'm using JBoss Embedded version beta3.SP10 and I'm facing a persistence bug that is should be fixed in some Hibernate version. Sadly, I don't know what version of Hibernate is used in my JBoss Embedded and couldn't find a way to find this information, the hibernate-all.jar bundled in it doesn't contain a org.hibernate.Version class, n...

DQL statement for many to many relationship

I'm confused about how DQL works, and really need some help here. I have three tables, called "Band", "Agent", and "BandAgent". BandAgent is the middle table for a Many-to-many relationship, containing agent_id and band_id. How can I retrieve all Agents related to a specific band_id using a DQL statement? EDIT This code works, but...

SQLAlchemy - ObjectDeletedError: Instance '<Class at...>' has been deleted. Help.

I'm having some issues with deleting rows from a database and then adding new ones. Here's the code: for positionid in form_result['responsibilities']: inputdata = form_result['responsibilities'][positionid] self.__deleterow(dbmyaccount.Responsibilities, session['authed']['userid']) for resp in (i.strip() for i in inputdata...

Lost with JPA @OneToMany and composite PK

I'm pretty lost with mapping the following structure with JPA annotations. +===========+ +====================+ | Offer | | Text | +-----------+ 1 0..* +--------------------+ | id (pk) |-------------| textkey (pk) | | namekey | | languagecode (pk) | | ... | ...

use DISTINCT ON Ejb-QL

is it possible to use PostgreSQL-like DISTINCT ON in EJB using named query? o.fromDate,o.empLeaveMasterId,o.employeeInfoId, o.leavePurposeId ,o.toDate,o.createdByUserId,o.createDate,o.lastModifiedUserId,o.lastModifiedDate,o.isSystemRecord The field describe above is my entity bean field and I want to get fromDate wise distinct record ...

JPA: which side should be the owning side in a m:n relationship?

Say for example I had to entities "Article" and "Tag" (like in a typical blog). Each article can have many tags, and each tag can be used by many articles, so it is a classical m:n relationship. I need to specify an owning side with JPA. But which side should be the owning side? An article doesn't depend on a certain tag and vice versa....

Autocreate Spring Entity "authorities" during testing

Hi all When trying unit tests with Spring Security & Hibernate, none of the security entities "user" or "authorities" are being autocreated. What I have done so far is to write an "user" bo that triggers generation of the appropiate table. However, I am stuck with the authorities: (as advised by http://java.dzone.com/articles/getting-s...

Derby database don't save entity after application running

I'm using Embedded Derby DB with hibernate. I'm saving some entities to database. After shutting down the application there is no entities in DB. Why it could be so? Below my Hibernate configuration <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "h...

Unable to get JPA working with Hibernate

For a weekend project I was trying to run JPA 2 with Hibernate 3.5. Please note that I am not getting any compile errors or runtime exceptions (when I deploy the war on Tomcat). Below is my code - persistence.xml <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" x...

Use PostgreSQL Domain and Struct types in Java

After creating EntityManagerFactory instance, I receive error message: ... Exception Description: Predeployment of PersistenceUnit [aPU] failed. Internal Exception: Exception [EclipseLink-7157] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.ValidationException Exception Description: Entity cla...

How to use JPA in spring sample petclinic?

I am learning spring samples. In the petclinic project, by default it uses jdbc. I change the following line to jpa, and can't run it anymore /WEB-INF/spring/applicationContext-jpa.xml Here is the error message: Caused by: java.lang.IllegalStateException: ClassLoader [org.apache.catalina.loader.WebappClassLoader] does NOT provide an ...

Locking Business Model

I have the necessity for a client application to "lock" (aka "check-out" certain business entities store in the database. The workflow is such that: The user navigates to a page for some business object. The user hits "edit". This locks the item from being edited by anyone else. Other users on other workstations will see a little "loc...

Performance Improvement

I am thinking about improving the performance of IO, I don't completely understand the IO structure and I would like some help from the developers here. I think if all fields are read when the first command to get ID and class is executed and stored in Object store and then RetrieveObject gets objects from ObjectStore it might give some...

Codlfusion ORM: Can not load SQL after an init of ORM.

Hi All, Trying to drop/create table with orm but facing a situation: When I try to drop/create table I see tables are created but data. I have a sql which contains data but no luck. I have proper definitions for the sql that has to be imported when I drop/create. this.ormsettings = {autorebuild="false"}; this.ormsettings.dialect= "...

Hibernate JPA one-to-one saving child class entity

I have a one-to-one relationship using PrimaryKeyJoinColumn annotated on the parent side. And now I want to save the child entity by itself. For example, I have Employee and EmpInfo as the child entity, I need to save EmpInfo (of course after setting the id property of the parent to it). However, when such an arrangement is used, I get ...

Hibernate, Persistance and delation of associations.

Hello, I have some problem with delation of associations, this is my code : Classe ModuleVersion @ManyToMany(mappedBy="listModuleVersions") private List<SuiteVersion> suiteVersions = new ArrayList<SuiteVersion>(); Classe SuiteVersion @ManyToMany() private List<ModuleVersion> listModuleVersions = new ArrayList<ModuleVersion>...