orm

How do I cure the cause of Hibernate exception "IllegalArgumentException occurred while calling setter"?

How do I cure the cause of the occasional exception IllegalArgumentException occurred while calling setter that Hibernate throws when my program attempts to load a user by name from the database? Am I incorrectly mapping column USER_RV in table User to class Integer instead of BigDecimal or some other integer type? Note that the same a...

Why do O/R Mappers seem to be the favored persistence approach for DDD users?

Why aren't there many DDD stories that use newer nosql tools such as db4o and Cassandra for persistence. In my view, the effort involved in O/R mapping seems too high for the returned value. Being able to report right off the database is the main advantage I can see for my projects. On the other hand, db4o seems to almost be the ...

Hibernate returning no results show this error INFO: Not binding factory to JNDI, no JNDI name configured

I am using JPA with hibernate and trying to connect to the a datasource to retrive information but when i run the application i get no error as such but no results are displayed when i run the following code.The question arose from a previous post located here when I was setting up the environment to do some testing of JPA with hibernate...

Hibernate one to many mapping

Hi, I have two tables: <class name="Content" table="language_content" lazy="false"> <composite-id> <key-property name="contentID" column="contentID"/> <key-property name="languageID" column="languageID"/> </composite-id> <property name="Content" column="Content" /> </class> and <class name...

Foreign key problem in Java Persistance API with Netbeans 6.9.1

Hi All, I have an error in setting up Java Persistence in Netbeans. I have used MySQL as Back-End Database Server. My Code is as below, Database CREATE TABLE `hub` ( `hub_ID` INT(11) NOT NULL AUTO_INCREMENT, `hub_Name` VARCHAR(45) NOT NULL, PRIMARY KEY (`hub_ID`), UNIQUE INDEX `hub_Name` (`hub_Name`) )ENGINE=MyISAM CREATE TABLE...

How to write to a column not in the domain entity?

In our SOA application we have several customers' data in the same database and in the same tables. To control access, we have a column that describes this relationship. This column isn't represented in the domain model, however. I know about query only properties - so, for querying - it is working perfectly. However, how do I write to...

joining two tables with differnt join column names

I have two tables A -> B with many-to-one mapping/associations. Table B's primary key is foreign key in table A. The problem is column names in both tables are different. let's say B has primary key column "typeNumId" which is foreign key in table A as "type". How can I join both tables on this column? how can I specify mapping to ind...

JPA support for XML datatype columns

For a new project we are starting (which uses JPA 2 on top of Hibernate 3) we need to be able to store XML documents and then query on their content and structure at a later date. The databases we would like to support are DB2, Oracle and SQLServer. I know all three DB vendors support native XML querying (using SQL and XQuery like state...

Recursive JPA query?

Does JPA 2 have any mechanism for running recursive queries? Here's my situation: I have an entity E, which contains an integer field x. It also may have children of type E, mapped via @OneToMany. What I'd like to do is find an E by primary key, and get its value of x, along with the x values of all its descendants. Is there any way to ...

SINGLE_TABLE inheritance strategy using enums as discriminator value

Is it possible to use an enum as a discriminator value when using SINGLE_TABLE inheritance strategy? ...

Detach JPA objects with lazy initialized properties

There are two JPA entities: User and Order with one-to-many relationship. /** * User DTO */ @Entity @Table(name="user") public class User implements Serializable { private static final long serialVersionUID = 8372128484215085291L; private Long id; private Set<Order> orders; public User() {} @Id @GeneratedValue(s...

How to query by page from to table by Hibernate?

I create 3 tables by Hibernate, how to return a List<task> when set task_status = ? and set create_user_id = ?, task_status in "dotask" table, create_user_id in task table. How to write the "HQL"? Here is mine, but I can't make it true with it: String hql="from task t left join dotask d on d.task_status = ? and t.create_user_id = ? li...

Can someone point me to a particularly good resource on JPA/Hibernate lazy/eager fetching?

Looking for a really good article that includes strategies/bugs/workarounds. I would prefer a pure JPA solution but I know Hibernate offers a lot of extensions. ...

ORMs for WebServices DataSources?

There seems to be lots of great Object Relational Mappers out there - several of which I have used myself (LLBLGen being one I like a lot). Does anyone know of any .Net tools out there to help build a rich Data Access layer when the DataSource is not a database - or more specifically, where the datasource is multiple, highly granular, we...

HBase ORM for Ruby

What HBase ORM/adapters for Ruby exists? Which are the best? WHY? ...

JPQL MySQLSyntaxErrorException: You have an error in your SQL syntax

Hello, I have two entities User and Group: @Entity public class User implements Serializable { private static final long serialVersionUID = 1L; @Id private String username; private String password; private String email; @ManyToMany @JoinTable(name="user_group", joinColumns={@JoinColumn(name="USERNAME")}, inv...

Is HibernateCallback best for executing SQL/procedures?

I'm working on a web based application that belongs to an automobil manufacturer, developed in Spring-Hibernate with MS SQL Server 2005 database. There are three kind of use cases: 1) Through this application, end users can request for creating a Car, Bus, Truck etc through web based interfaces. When a user logs in, a HTML form gets d...

SQLAlchemy context sesitive function for creating a composite value on insert and update

I'm trying to sort out how to add a context sensitive function (e.g. def get_user_full_name()) that will get triggered from the default and onupdate specifications on a column. I'm trying to set a composite field that combines the first and last names into a single full name value to avoid having to constantly concat the two fields in a...

Hibernate - How to map a new class to two existing Tables

I have two entities: Vehicle and Weapon classes. They are mapped respectively to Vehicle.hbm.xml and Weapon.hbm.xml. Both have their respective DAOs. All are working fine. Here's my idea. I want to create a class VehicleWeapon that has all the properties of the Vehicle and Weapon entities. I want to declare a Hibernate mapping file: Ve...

EntityManager not fetching from database?

Hello, I have entities: Post, User, Comment with bidirectional relationships: --------- 1 * --------- | Post | <--------> |Comment| --------- --------- --------- 1 * --------- | User | <--------> |Comment| --------- --------- I have simple page which displays single post and all its comments and...