orm

Perform a SQL JOIN on Django models that are not related?

I have 2 Models, User (django.contrib.auth.models.User) and a model named Log. Both contain an "email" field. Log does not have a ForeignKey pointing to the User model. I'm trying to figure out how I can perform a JOIN on these two tables using the email field as the commonality. There are basically 2 queries I want to be able to per...

Use of Hibernate 3.0 with EJB 3.0 & JPA

Where I'm working the guys that are sitting across from me are working on a project. This is a JavaEE app which uses Struts, Spring, EJB 3.0, JPA, and Hibernate 3.0. They are using EJB 3.0 entity beans with annotations. I've been asking them why Hibernate 3.0 is in this mix and noone can seem to tell me. It feels like they've include...

iBatis circular references question

I have an Office object and a Device Object. An Office has a device and a device belongs to an office. So, obtaining an Office object should populate Office.Device reference and a Device object should have an Office object where it belongs. It's a circular reference I suppose. I'd like to do this in iBATIS, but I can't figure out how ...

How to force Hibernate 3.3 or 3.5 to use CGLib instead of Javassist?

Is it still possible to force Hibernate 3.3 or 3.5 to use CGLib instead of Javassist? In my properties file, I set hibernate.bytecode.provider = cglib But this doesn't seem to do it. Any thoughts? ...

What orm.xml features should be avoided to stay database agnostic?

I'm embarking on an adventure in JPA and want to, inasmuch as possible, stay database agnostic. What orm.xml features should I avoid to stay database agnostic? For example, if I use strategy="AUTO" in orm.xml as follows: <id name="id"> <generated-value strategy="AUTO" /> </id> ...then MySQL shows it as an AUTO_INCREMENT column w...

"cascading" a hibernate entity listener?

Hi, Using hibernate 3.2.4.sp1 I have two entities User and ContactInfo A User has a related ContactInfo, relation is unidirectional, i.e. ContactInfo has no idea about the user it belongs to (nor should it as it is reused in other relations) The User entity has an entity listener preventing other users than the actual user itself t...

Hibernate, instrumentation and delete cascade order

I have a complex object graph with JPA connected entities. When I delete the parent the deletions cascade correctly to the children. Then I instrument the parent class (as to not load eagerly one-to-one relationships) and upon deletion I get referential integrity violation exceptions. Looking at the queries hibernate issues upon flush,...

Is cayenne good choice for my requirement?

We are evaluating ORM solutions for my project that has tight coupling between business layer and datalayer(JDBC). I started doing a PoC with Cayenne. My requirement goes like this a) Already there exists database schema b) Schema is very granular level. I.e. real time java objects are only derived by combining tables. c) At the moment I...

Adaptive optimization of django transaction size

I'm bulk loading data into a django model, and have noticed that the number of objects loaded into memory before doing a commit affects the average time to save each object. I realise this can be due to many different factors, so would rather focus on optimizing this STEPSIZE variable. What would be a simple algorithm for optimizing th...

Hibernate casts BigDecimal instead of Integer

Hi there, I don't know why but hibernate tries to cast BigDecimal to one of my columns. This column is definied as Decimal(3,0) in my DB2 DB. So there can't be a BigDecimal. hbm.xml <composite-id name="Id" class="db2.P5Id"> .... <key-property name="land" type="int"> <column name="PFIELD1" precision="3"/> </key-pro...

NHibernate + Mappings + Domain Model = Over-engineering?

Background I really like Fluent NHibernate - it's pretty great. I don't have to write those mundane CRUD-based SQL stored procedures and that's great (not that there's anything wrong with that)! I've gone down this path a bit on an application we're working on. And now I'm sitting with a couple dozen domain objects, each with a reposit...

Are document-oriented databases any more suitable than relational ones for persisting objects?

In terms of database usage, the last decade was the age of the ORM with hundreds competing to persist our object graphs in plain old-fashioned RMDBS. Now we seem to be witnessing the coming of age of document-oriented databases. These databases are highly optimized for schema-free documents but are also very attractive for their ability ...

Requesting advice on persisting objects from a dynamic language to a document database

Hi, Do you have any insights into the most elegant way of persisting objects from a dynamic language in a document database? I have a solid background in C# and have just started programming in Python. At the same time I am trying to learn the ropes of MongoDB. Now I am wondering: what is the most elegant way to persist my data to t...

Subsonic 3 Linq Documentation

I'm started looking at Subsonic just yesterday and having trouble figuring out how to do even the most basic tasks. I've watched the demos for ActiveRecord and SimpleRepository, but they don't fit what we want so I'm trying to use the Linq Templates. The getting started guide for Linq walks through enough to do a query, but how do I ...

"correct" way to select next sequence value in HSQLDB 2.0.0-rc8

suppose i have a sequence, called TEST_SEQ what would be the correct way of selecting its next value ? this does not work: select next value for TEST_SEQ probably because it expects a "FROM" clause. looking at HSQLDialect.getSequenceNextValString() in hibernate i see this: "select next value for " + sequenceName + " from dual_" + sequ...

Hibernate - StaleObjectStateException in query possible?

Is it possible to get a StaleObjectStateException with Hibernate when you do the same query twice inside one tx if the result data of that query gets changed by a concurrent update inside a different session between the first and the second query? I am using optimistic concurrency control on all entities in this scenario. So it looks l...

Is it possible to get the SQL alias of a join table for a Hibernate sqlRestriction?

I have a Person class which has a String collection of aliases representing additional names that person may go by. For example, Clark Kent may have aliases "Superman" and "Man of Steel". Dwight Howard also has an alias of "Superman". @Entity class Person { @CollectionOfElements(fetch=FetchType.EAGER) Set<String> aliases = new Tr...

NHibernate and Windsor assembly conflicts

Hi, I am having an issue getting Hibernate and Windsor to work together. My setup details are as follows I have two projects -DomainModel -MVCApp I have downloaded NHibernate 2.1.2 and Windsor 2.1.1 I added the following references to DomainModel from the required_Bins folder of the NHibernated download - Antlr3,Iese,log4net and NHi...

Eclipse + MySql + Hibernate, a good intro?

I'm looking for a tutorial explaining how to work with these 3 technologies, found this one, but it's working with HyperSql DB (yeah, I edited hibernate.cfg.xml to connect with MySql... but I just received a bunch of errors). ...

How to know/log whether Hibernate 2nd-level cache was used or not for a query?

Hi, Currently, in order to check if the Hibernate 2nd-level cache was used for a Database query, I check my SQL log (through p6spy or logSql=true in Datasource.groovy) to see if the Grais/Hibernate triggered an SQL query. And I assume that if the query was not logged, it might mean that cache was used. It is pretty complicated for a ...