orm

Hibernate (JPA) Entity with Static collection as a member

Is it possible to have a static collection as a member of a hibernate entity? Say I have an object Question: public class Question { private String category; ... } Would it be possible to populate a static Set<String> that is a distinct set of all categories in the Database? I know I could just query this, but I was wonderi...

Hibernate Query Language Problem

Well, I have implemented a distinct query in hibernate. It returns me result. But, while casting the fields are getting interchanged. So, it generates casting error. What should be the solution? As an example, I do have database, "ProjectAssignment" that has three fields, aid, pid & userName. I want all distinct userName data from this ...

How to list all the objects with a specific date no matter the time in a DateTime Field

I Have a model like this foo=models.char bar=models.dateime In wich several foos arrives in one day in different time. I need to list all the foos in a specific date, no matter the time they arrive. I can't change the model, so splitting the bar in two fields(one for date and one for time) is out of reach right now :( ...

Updating join fields in an ORM command

I have a question about object relational updates on join fields. I am working on a project using codeigniter with datamapper dmz. But I think my problem is with general understanding of ORMs. So fell free to answer with any ORM you know. I have two tables, Goods and Tags. One good can have many tags. Everything is working, but I am lo...

Many-to-many mapping with LINQ

I would like to perform LINQ to SQL mapping in C#, in a many-to-many relationship, but where data is not mandatory. To be clear: I have a news site/blog, and there's a table called Posts. A blog can relate to many categories at once, so there is a table called CategoriesPosts that links with foreign keys with the Posts table and with Cat...

Where do DQL statements live in an application that is using Zend Framework and Doctrine

In an application that is using Zend Framework 1.10 and Doctrine 1.2, where should the DQL statements live if our application is built such that it has a Service Layer and a Gateway(aka Doctrine_Table) layer. It seems that our possibilities include: 1) Placing the DQL statements in the Service layer which seems to be a bit too high in ...

Getting latest Subsonic builds

I need the latest Subsonic build or build it by my own. Subsonic project web site shows the latest available version is Subsonic v3.0.0.3 released at July 15, 2009. Questions: Are there any later builds - e.g. maintained by community members? If so, how can I get the latest one? In worst case I'm ready to get the latest source code an...

Kohana 3 ORM - grouping where conditions with parentheses

I'm trying to run a query through the ORM like this: SELECT * from table where (fname like 'string%' or lname like 'string%') AND (fname like 'string2%' or lname like 'string2%'); Here's what i have so far: $results = ORM::factory('profiles'); foreach ($strings as $string) { $result->where('fname', 'like', "$string%"); $r...

What's the best way to calculate similarity between rows in a table based on association?

Suppose each Person has a collection of favorite Books. So I have a table for: Person Book The association between Person and Book (joint table for MxN) I want to fetch the Persons that are similar to a Person1 based on the favorite Books overlaping. That is: The more books they have in common, the more they are similar. I don't ha...

@OneToOne and @JoinColumn, auto delete null entity , doable?

I have two Entities , with the following JPA annotations : @Entity @Table(name = "Owner") public class Owner implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private long id; @OneToOne(fetch=FetchType.EAGER , cascade=CascadeType.ALL) @JoinColumn(name="Data_id") private Dat...

NonUniqueObjectException on saving joined tables

I have two related tables in a many to many relation: Role and Permission. The join table is RolePermission. The Role object has a list of permission. it looks like this: private Set<Permission> Permissions; @ManyToMany(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }) @JoinTable(name = "permission_role", joinColumns = @Jo...

Creating tables with EZPDO

Hello everybody. I'm starting with EZPDO and was wondering if there is any way to, having the PHP class, construct the DataBase diagram. For example. I've this class: <?php /** * class Localidad * @orm mysql://xxx:[email protected]/yyy */ class Localidad { /** * @orm integer */ public $id_alquileres; /** * @or...

In Grails / Hibernate Can you set the generator to increment only if not assigned?

is there a way to have hibernate use auto generated ids if it wasn't assigned but use the assigned value if it was? ...

LINQ to SQL or classic ADO.NET?

I am asking my self many times before start writing a new app or data access library , should I use LINQ to SQL or classic ADO.net , I have used both and the development time I spend on building an app with LINQ to SQL is like the 1/3 compared to ADO.net. The only think I like using LINQ to SQL is that I don't have to design the domain ...

Dynamic class_name for has_many relations

I'm trying to make has_many relation with dynamic class_name attribute class Category < ActiveRecord::Base has_many :ads, :class_name => ( lambda { return self.item_type } ) end or class Category < ActiveRecord::Base has_many :ads, :class_name => self.item_type end But i got errors: can't convert Proc into String or undefi...

Are there any good ORMs (preferably JPA implementations) that support SQLite (on Android)?

I found a post from a while ago that addresses a similar question but I think it's a bit outdated. I realize implementations of JPA tend to be more on the heavy/dense side, so if you know of any lightweight (non-JPA) ORMs I'll most certainly appreciate your input. I did see the answer about ActiveAndroid in the other post and am curious ...

How to exclude results with get_object_or_404?

In Django you can use the exclude to create SQL similar to not equal. An example could be. Model.objects.exclude(status='deleted') Now this works great and exclude is very flexible. Since I'm a bit lazy, I would like to get that functionality when using get_object_or_404, but I haven't found a way to do this, since you cannot use excl...

Trying to make models in Kohana, relations problem.

I have a table of Hits, Articles and Categories Now, a Hit belongs_to an Article/Category (depends on where it was done). so I have a column on Hits table with the name 'parenttype' That tells me 'Article' or 'Category'. I wrote in the Hit model (extends ORM) protected $_belongs_to= array( 'page' => array('model'=> $this->parent...

Is JPA expertise transferable to Toplink?

How similar are JPA and Toplink such that expertise in one could carry over to the other? ...

Should i care/have knowledge about nHibernate before choosing Fluent nHibernate?

I was going through Fluent nhibernate wiki and i know that Fluent nhibernate is built on top of nHibernate... Should i care/have knowledge about nHibernate before choosing Fluent nHibernate? Any suggestion... ...