orm

Is this a common database design / OO Mapping technique?

I've recently been asked to rewrite a booking system that was not performing as well as a client would like. I've found the database schema / object mapping technique used to be quite unusual and was wondering if anyone else has come across anything similar. The old system used about 25 classes for things like customers, appointments ...

Seam Hibernate Cannot open Connection

I am trying to create a menu. And, for some reason I get "org.hibernate.exception.GenericJDBCException: Cannot open connection" error, but same project works just fine on my desktop, I don't get it. Here is the stack trace: javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Cannot open connect...

How can I do bi-directional mapping over @Any annotated property?

In this article http://www.jroller.com/eyallupu/entry/hibernate_the_any_annotation and also in this question http://stackoverflow.com/questions/217831/how-to-use-hibernate-any-related-annotations, how @Any annotation can be used was explained. But how can I get borrows for each DVD/VHS/BOOK? How can I do mapping definition on DVD/VHS/BOO...

Redbean O/RM store "date" as varchar(255) ?

From this code: $toolbox = RedBean_Setup::kickstartDev("mysql:*****************"); $r = $toolbox->getRedBean(); $test = $r->dispense("test"); $test->nom = 'Test #1'; $test->date = '2010-07-08'; $test->date_deux = '08/07/2010'; $test->num = 5; $id = $r->store( $test ); I get this SQL: CREATE TABLE IF NOT EXISTS `test` ( `id` int...

Mapping a ManyToMany relationship with hibernate annotations?

Table Layout: TABLE ORDER: id localizedInfoId Table OrderLocalizedInfo: id localizedInfoId name With the following entities: public class Order { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="id") private Long id; @ManyToMany( targetEntity=OrderLocalizedInfo.class, cascade...

Django DecimalField lookups with MySQL not working

I'm migrating data from a legacy database that has many tables with primary keys defined like: `id` decimal(26,0) The id column will contain values that look like: 20080313154354198004 20081217165552136057 2008080416222952067 20060510151423191000 20060510151423191000 20070710143455874025 200806239353171091 Doing queries like: Rel...

Hibernate, MySQL and table named "Repeat" - strange behaviour.

I am having a strange problem. But first the orm.xml: <entity class="de.test.businessobjects.Repeat"> <table name="repeat"/> <attributes> <id name="id"> <generated-value strategy="TABLE"/> </id> <many-to-one name="repeatType" fetch="LAZY"> <join-column name="id_repeatType"/> ...

JPA Exception: No Persistence provider for EntityManager named MyJPAApplicationPU

I am newbie with JPA. I'm trying to run some sample code using JPA but I get the following exception: javax.persistence.PersistenceException: No Persistence provider for EntityManager named MyJPAApplicationPU I put my exception message here, INFO: Could not find any META-INF/persistence.xml file in the classpath javax.persistence.Per...

What's the use of session.flush() in Hibernate

When we are updating a record, we can use session.flush() with Hibernate. What's the need for flush()? ...

jpa without container

Hi, I like to use jpa, but without application container. I intend it to use it in console application. Is there any example ? Regards ...

CRUD Class for PHP (Simple but will Allow Relational Data)

I am building a database of products and manufacturers. I already have the database layout done. I am looking for a simple CRUD class that will let me setup Manufacturers and Products and create the records quickly and easily. I have looked at ORM's but they all seem to be over kill for what I am looking for. Thanks ...

Hiberate / JPA -> Nullable values & objects?

Hi My basic question is: How can I force Hibernate to make float NULLable and accept NULL for float, datetime, blob, respectively? I really mean NULL, not (float) 0.0. Even worse, when I try to store an object with the desired NULLable fields actually being NULL and using entity manager, I get errors for attributes, which are marked as...

Why ActiveRecordHooksBase.OnUpdate does not work in cascaded mode?

Suppose we have two entities Blog and Post that Blog has many Posts. Post is saved indirectly through Blog. When I override OnUpdate in Post, it causes to save Posts that have null Blog. In the other hand overriding OnUpdate in Post causes not saving it properly. Someone else have had same problem. The code is: protected override void ...

Hibernate: What am I missing? Can't find @Id, instead @Index

Every example I have found uses @Id, but when I try to write my code, many of the annotations that I'm used to are gone, there are annotatoins like @Index, and the @Entity parameters have changed. I've looked through the Hibernate documentation, and can't find anything talking about changing all of their annotations, so am I looking at ...

Lazy loading, Deferred Loading and Eager Loading in Entity framework

What are the differences between these 3 types of loading? Can someone explain with an example? Different resources online use different definitions causing more confusion than necessary. ...

ORM using Hibernate's annotations with Spring

Hi! I'm trying integrate spring with hibernate but catch exception on project start. Caused by: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class="com.domain.Worker"/ My config: from spring <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="clos...

Returning nested entities

Hi everyone I'm working in a three tier asp.net/CSharp application and I'm having issues implementing the entity CRUD operations. I'm using a custom reflection-based ORM for my data layer which maps table records from my database to the respective properties in the corresponding entity classes. My business layer currently is rather thi...

LINQ to SQL querying against a view to populate an object model

We have the following data model: CalendarAppointment 1 <------> * AppointmentRole * <--------> 1 Person (or Group) A calendar appointment can have multiple persons associated with it. Each person can be in a different role (attending, driving, picking up or dropping off). (A person can also be a member of a group and groups can be ...

LINQ to SQL query against joined tables with criteria from both tables resulting in hierarchical object model

We have a calendaring application in which each appointment can have multiple persons associated with it. Appointment 1 <--> * AppointmentPerson Appointment Date ID AppointmentPerson AppointmentID (FK to Appointment.ID) PersonID The simplest query is to find all appointments for a given person and date. Using LINQ to SQL we...

Doctrine adding a many-to-many relation for transient records

two models Site and Language share a many-to-many relationship (they are bi-directional) How do I add a relationship between them? Ideally I want to do this : (add an existing language to a new Site) $site = new Site(); $site->name = "Google" $site->url = "www.google.com"; ---- code to add language---- $site->save(); Or should I onl...