orm

How to implement table-per-concrete-type strategy using entity framework

I'm mapping a set of tables that share a common set of fields: So as you can see I'm using a table-per-concrete-type strategy to map the inheritance. But... I have not could to relate them to an abstract type containing these common properties. It's possible to do it using EF? BONUS: The only non documented Entity Data Model Map...

How to limit columns returned by Django query ?

That seems simple enough, but all Django Queries seems to be 'SELECT *' How do I build a query returning only a subset of fields ? ...

What's best practice to check if an object is part of a ManyToMany relationship in Django

from an instance of Site with a ManyToMany relationship to Kiosk, i'd like to check if a Kiosk object is part of the relationship. I could do self.apps.get(id=app_id).exists() and check if True or self.apps.get(id=app_id) and catch the ObjectDoesNotExist error or self.apps.filter(id=app_id) and check if True If I have to ca...

php framework with sqlite, orm, i18n, l10n search addon

im trying to find a php framework to build small,multilingual sites. do you know a php framework with support for: 1.sqlite (it will be little sites so no performance problem and good for copy-paste from development to production) 2.orm 3.i18n & l10n 4.easy search addon 5.ability to just copy-paste no need to change config for goin...

Hibernate design: persistent data plus temporary run-time classes

The question is this. I have a number of persisted objects that I'll pull using Hibernate. But during the application lifetime I'll create a few objects that do not live outside the running time of an app. They are temporary, for example contain user's choices, and they also hold links to the persistent objects(tables). But as soon as...

Attching a Behaviour to a dynamically created table in Doctrine

How do I programmatically attach a Doctrine Behaviour to a table dynamically created through $conn->export->createTable('MyTable', $definition)? For example, if I have the following code: $definition = array( 'id' => array( 'type' => 'integer', 'primary' => true, 'autoincrement' => true ), 'name' => ...

EclipseLink generates cartesian plan instead of (inner) joins in SQL. Why?

Hello again, In the projects where Hibernate is my persistence provider, I can issue queries with 'join fetch' expressions, and Hibernate will generate SQL that mirrors that: SQL containing join expressions using valid paths of comparison. EclipseLink, however, issues SQL with ugly cartesian plans, that hurt performance quite badly. Wh...

Pros & Cons: Hibernate vs. EJB 3

What are the advantages and disadvantages of Hibernate & EJB3 relative to each other? I found this post, but it didn't really address my question. If I don't have any particular tie to either technology, what would cause me to pick one over the other? Or are there situations where I would want to use both? Thanks, Zack edit: in respon...

Is there something like a "long running offline transaction" for NHibernate or any other ORM?

In essence this is a followup of this question. I'm beginning to feel that I should give up the whole idea, but I'll give it one more shot. What I want is pretty much like a DB transaction. It should track my changes to the DB and then in the end allow me to either commit or rollback them. If I insert an object, I should get it back in ...

Beginner question: basic insertion idiom for JPA?

My "HelloJPA" code (below) tries to store an Employee in a datastore. However, any attempt to read the persisted object after committing the (resource local) transaction is rewarded with an "IllegalStateException": Employee employee = ... EntityManagerFactory factory = Persistence.createEntityManagerFactory( "HelloJPA", System.getPr...

How do you use asynchronous ORMs without huge callback chains?

I'm using the relatively immature Joose Javascript ORM plugin (project page) to persist objects in an Appcelerator Titanium (company page) mobile project. Since it's client side storage, the application has to check to see if the database is initialized before starting up the ORM since it inspects the DB tables to construct the classes. ...

Need help with NHibernate / Fluent NHibernate mapping

Let's say your have the following table structure: ============================== | Case | ============================== | Id | int | | ReferralType | varchar(10) | +---------| ReferralId | int ...

Hibernate orm for a view

How do you ORM a view? Is there any difference with a table in terms of reverse engineering? In my case, I have a whole pile of joined tables that will be read-only in an application. So, if I need sort of an Object with all collections in proper order, instead of long chains of relationships - collection with another etc, it'll be si...

Approach to mapping dictionary database tables to models in MVC

Hi, lacking a fellow programmer to talk over the right approach for my problem, I decided to ask you. What is your preferred approach of mapping dictionary tables to a model in MVC paradigm, regardless of the MVC framework / environment you are using? My problem is I have a couple of database tables that only serve as dictionaries and ...

Stored procedure output parameter set back to POJO by iBATIS

I'm using iBATIS to call a Stored Procedure on MSSQL Server, the input parameters are properties on a POJO that is put to the map: Map<String, Object> saveMap = new HashMap<String, Object>(); saveMap.put("obj", myArticle); update("save", saveMap); All parameters are set correctly as input to the procedure so nothing wrong there. But o...

How to use my own connection when using iBatis Data Mapper?

How can I use my own connection Provider when using iBatis Data Mapper? I have to use UserId and Password of the user performing the db operation in the ConnectionString? E.g. The following ConnectionString has to be modified to insert the userid and password for user performing the db operation. Data Source=TEST;Persist Security Info=T...

Django query: Count and Group BY

I have a query that I'm trying to figure the "django" way of doing it: I want to take the last 100 calls from Call. Which is easy: calls = Call.objects.all().order_by('-call_time')[:100] However the next part I can't find the way to do it via django's ORM. I want to get a list of the call_types and the number of calls each one has WITH...

Django queries: Count number of objects with FK to model instance

This should be easy but for some reason I'm having trouble finding it. I have the following: App(models.Model): ... Release(models.Model): date = models.DateTimeField() App = models.ForeignKey(App) ... How can I query for all App objects that have at least one Release? I started typing: App.objects.all().annotate(re...

Advice on Linq to SQL mapping object design

I hope the title and following text are clear, I'm not very familiar with the correct terms so please correct me if I get anything wrong. I'm using Linq ORM for the first time and am wondering how to address the following. Say I have two DB tables: User ---- Id Name Phone ----- Id UserId Model The Linq code generator produces a bun...

Is it possible to select data with max value for a column using Criteria in Hibernate?

Lets say I have the following mapping: <hibernate-mapping package="mypackage"> <class name="User" table="user"> <id name="id" column="id"> <generator class="native"></generator> </id> <property name="name" /> <property name="age" /> </class> </hibernate-mapping> Is it possible to select the oldest user (that i...