orm

ORM with automatic client-server data syncronization. Are there any ready to use solutions?

Consider the client application that should store its data on remote server. We do not want it to access this data "on-fly", but rather want it to have a copy of this data in local database. So we do not need connection with remote server to use application. Eventually we want to sync local database with remote server. The good example o...

JPQL Create new Object In Select Statement - avoid or embrace?

I've learnt recently that it is possible to create new objects in JPQL statements as follows: select new Family(mother, mate, offspr) from DomesticCat as mother join mother.mate as mate left join mother.kittens as offspr Is this something to be avoided or rather to embrace? When is usage of this feature justified in the light ...

Copy a Doctrine object with all relations

I want to copy a record with all his relations. I'm trying with: $o = Doctrine::getTable('Table')->Find(x); $copy = $object->copy(); $relations = $o->getRelations(); foreach ($relations as $name => $relation) { $copy->$relation = $object->$relation->copy(); } $copy->save(); This code doesn't works, but I think it's on the way. ...

Can ActiveRecord create tables outside of a migration?

I am working on a non Rails web app, so no migrations script by default. The Sequel ORM lets me create tables easily in a script: #!/usr/bin/env ruby require 'rubygems' require 'sequel' ## Connect to the database DB = Sequel.sqlite('./ex1.db') unless DB.table_exists? :posts DB.create_table :posts do primary_key :id varcha...

jpa embedded class need cachable?

my entity class is annotated with @Cache, my primary keys are combined of few table fields, primary keys are embedded into this class as embedded class. Do I need to put @Cache for the embedded class as well? ...

What SQL ORM may i use to replace this old code

Sorry since this question is specific to my problem. While learning reflections i did a mini SQL ORM in a week then minor tweaks while using it for another week. Since it has very little work put into it, its really only compatibility with sqlite. I havent had problems with the code so far but i would like to port it to something that s...

LINQ vs. nHibernate

Question: Until now, I didn't know LINQ was an ORM tool. I always saw it as some new kind of SQL query language. So I very recently started using nHibernate. So my question: What would be the advantages and disadvantages of LINQ in comparison to nHibernate? As far as I found out, the differences are that LINQ requires .NET > 2.0 (unle...

Integrating SQLAlchemy's ORM with existing classes in pylons.

I have a class in my existing python project, User, that I would like to map to tables. But I'm not sure what the best way to do this is? Does this mean I can remove: class User: pass from my model/__ init __.py? Or should I leave that in there, and have something like: from project.model.user import User class User: pass ...

Maven cannot exec a jar project because the mess with transitive dependency

I have 5 maven projects: simple-model, simple-weather, simple-persist, simple-webapp and simple-console. (They are from the Maven Definitive Guide book). The simple-console depends on simple-weather and simple-persist. simple-persist and simple-weather both depend on simple-model: simple-console ---> simple-weather ----> simple-model ...

How much overhead do frameworks like Hibernate bring?

Developers are sometimes scathing of mult-tier Enterprise web applications... 'Enterprise' is viewed by some as synonymous with slow, bloated and resource-hungry. Do frameworks such as Hibernate actually bring in a non-trivial impact on performance compared to writing your own DAOs or other less abstracted approaches? By non-trivial I s...

Ordering results by computed value in Hibernate

Hello, I have a table Player with columns id, name, wins, games_played. I mapped it to a class Player. I want to do the following query in Hibernate (preferably with Criteria, if not possible with Criteria HQL will also help) select * from Player order by (wins / games_played) I expect to get List<Player> sorted by their win rat...

How can I set hibernate database config from outside config file?

I need to have hibernate database config set from outside text file, how can I do it? Is there some kind of method for this, or do I have to make my own? ...

Error when trying to use hibernate annotations.

The error I'm receiving is listed here. That's my HibernateUtil.java package com.rosejapan; import org.hibernate.SessionFactory; import org.hibernate.cfg.AnnotationConfiguration;; public class HibernateUtil { private static final SessionFactory sessionFactory; static { try { // Create the Sess...

How can I sum a field from a grandchild table in a LINQ to DataSet where clause?

I think I need to do exactly this, but instead using LINQ to DataSets because the "Transactions" table is in DB2 and there is no data context. http://stackoverflow.com/questions/1813285/linq-query-across-three-levels-of-tables-to-generate-sum I setup two DataRelations on the DataSet: 1. relate Categories (ds.tables[0] in my example) to...

define named query in orm.xml with jpa and hibernate

Hello, I'm trying to put my named queries in my orm.xml (put in META-INF with persistence.xml) but my orm.xml seems to be ignored by hibernate/jpa. When I try to create my named query with em.createNamedQuery("myQuery"), it returns that it can't find this query. I use annotation and I would like to externalize my named queries in orm...

Is it possible to output generated SQL using EclipseLink without having to increase log verbosity?

Hello! I want to output the SQL generated by EclipseLink to the console, during development. However, I could only do so using the logging level FINE. I have a complex domain model composed of many classes, so much that deployment takes a considerable ammount of time when the log verbosity is on the FINE level, since EclipseLink outputs...

How to integrate access control with my ORM in a .net windows form application?

I am developing a general database query tools, a .Net 3.5 Windows Form application. In order to make the presentation layer is independent of the database layer. I use an ORM framework, XPO from DevExpress. But, I have no access control function built in. I surfed Internet and I found in WCF Data Services, there is an interesting conce...

SQLAlchemy - Problem with an association table and dates in primary join

Hi, I am working on defining my mapping with SQLAlchemy and I am pretty much done except one thing. I have a 'resource' object and an association table 'relation' with several properties and a relationship between 2 resources. What I have been trying to do almost successfully so far, is to provide on the resource object 2 properties: pa...

Mapping multiple domain objects to the same table using GORM DSL

Hi, I'm creating a grails app over a legacy database. There is a table out of which I would like to create several different domain objects (Type1, Type2 and Type3 in my example below). The table is like this : ID TYPE DESCRIPTION 1 type1 description of a type1 object 2 type1 description of another type1 object 3 t...

Hibernate Annotation for Entity existing in more than 1 catalog

I have a Person entity mapped by Hibernate to a database table in a database catalog "Active". After a period of time, records in this database table in the "Active" catalog are archived/moved to an exact copy of the table in a database Catalog "History". I have the need to retrieve from both the Active and History Catalogs. Is there ...