orm

Many-To-One Relation Query in Django

Hi, Can someone tell me, how I can access all contacts relating to a specific group? I'm new to Django and did this (according to the docs): def view_group(request, group_id): groups = Group.objects.all() group = Group.objects.get(pk=group_id) contacts = group.contacts.all() return render_to_response('manage/view_group...

DB design strategy in Visual Studio

Hi All, I'm currently investigating ASP.NET MVC 2 and LINQ to SQL. It all looks pretty cool. But I have a few application and development lifecycle issues. Currently, I design the DB in SqlServer Management Studio. Then I update my DBML files by deleting and re-importing modified tables. Issues: I can't find how to simply update the...

Custom Collection in Doctrine2

Just starting to work with Doctrine2, and am wondering how/if I can use a custom collection class. Searches point me to this part of the documentation: Collection-valued persistent fields and properties must be defined in terms of the Doctrine\Common\Collections\Collection interface. The collection implementation type may be used by ...

How to find table related with an alias in Doctrine ORM query?

I'm using Doctrine ORM 1.2 and Symfony 1.4 and I want to create method in myUser class which will extend Doctrine_Query instance passed as an argument with some additional left joins and conditions. The trick is that I don't always want these these left joins to be made with root component of the query and I need to know with what table ...

How does Big O relate to N+1?

Big 0 attempts to answer the question of inefficiency in algorithmic complexity. N+1 describes inefficiency as it relates to database queries in terms of separate queries to populate each item in a collection. I'm currently trying to get my head around each of these concepts in different contexts at work, and I'm wondering now if somebo...

Kohana 3 ORM Auth Module: how do i get a users role from the user object?

Hey all, I'm having some trouble wrapping my head around the user roles situation. i do understand the way they get created on inserting a new user, but i was wondering if there is a good way to get a users role into the user object, so that i can check for it in the controller. thanks :) t ...

Howto implement Spring Security User/Authorities with Hibernate/JPA2?

I am trying to implement DAOs to work with Spring Security database authentication in Hibernate/JPA2. Spring uses following relations and associations in order to represent user & roles: repesented as postgresql create query: CREATE TABLE users ( username character varying(50) NOT NULL, "password" character varying(50) NOT NULL, ...

What are popular ways to pre-populate the database for Selenium testing?

If I have a test that requires X widgets as a precondition, I'd like to avoid the tedious process of making X widgets in the test through the front-end. The main alternatives appear to be either having a stated DB dump that is loaded for each test run, guaranteeing a pre-determined state (the dump file is generated by doing the precondit...

How to re-attach an object to EclipseLink session after deserialization

Here's a simple POC: public void main(String[] args) { final String FILE_NAME = "c:/poc.ser"; try { HotelJdo hotel = HotelJdoFinder.findById(430); ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(FILE_NAME)); // serialize the object oos.writeObject(hotel); oos.close(); ...

ejb3: mapping many-to-many relationship jointable with a simple primary key

often in books, i see that when a many-to-many relationship is translated to a DB schema, the JoinTable gets a compound key consisting of the primary keys of the tables involved in many-to-many relationship. I try to avoid compound keys completely. So i usually create a surrogate key even for the JoinTable and allow the database to fill ...

Is there a tool or script that generates database out of PHP models?

Is there a tool or script that generates and syncs database out of PHP models, just the way like Django does it for Python? I'm aware of tools that generate databases out of XML, YAML, etc... I don't want it. I want to write production code on PHP, describing models, then run "syncdb" and get the database, that is ready to work with des...

Force Hibernate query to access database

I have loaded an entity into my transaction and have changed a property of that entity. The transaction is not yet commited. Now I would like to get the original value of the changed property. I've tried with a HQL query like select p.property from Person p where p.id = 1 with the ID of the entity loaded in the transaction. I've set q...

Can an ORM be use for a system where the access is thru methods that returns DataTables ?

We have a system (third party) where we access a web service to read data from its underlying database that returns .Net DataTable objects and in some cases even DataSet. The system sometimes (depends on the web method) accepts the modified DataTable/DataSet to update/insert/delete data. Other times, some web methods only have paramete...

Eclipse does not recognize content of persistence.xml

Im getting the following error in eclipse: The persistence.xml file does not have recognized content. My persistence.xml file works great in my application but eclipse keeps giving me this error. I got this after moving the file and updating my project configuration with m2eclipse. I did not change the file itself. Anyone knows how to...

help using django's ORM for UNION query

Hi people, i am making a history page for a website. The structure of my classes is something like this: class Person(models.Model): name = models.CharField(max_length=100) type = models.CharField(max_length=30) class History(models.Model): date = models.DateField(max_length=100) action = models.CharField(max_length=...

Kohana Framework: add default option

<?php // My controller. $marcas = ORM::Factory('marca')-> find_all()-> as_array('nome', 'nome'); array_unshift($marcas, '-- Selecione --'); ?> <?php // My view. echo Form::select('marca', $marcas, '-- Selecione --') ?> Is there a faster way to add a default option in a select? Thank you. ...

how to create a Storm table with no primary key?

I'm trying to use Storm to create an ORM to an existing MySQL db. I'm trying to create a table Class for one of the tables but I'm getting this error: storm.exceptions.ClassInfoError: <class 'statsstorm.Aggframe'> has no primary key information This table has no primary key, or any combination of columns that produce a unique row. It...

Using longblob in hibernate

I'm new to the hibernate world and I am using it to map a table that stores files of all types. I am however recieving a very strange error: javax.servlet.ServletException: java.lang.ClassCastException: [B cannot be cast to java.sql.Blob I have mapped my MySql LONGBLOB column has: <property name="fileData" type="blob" .../> and <prope...

ISession per Request (Only when necessary)

Hi Friends, I'm developing an application (asp.net mvc) and I'm using ISession per request (in globa.asax I use Bind and Unbind in Begin_Request event and End_Request event). Everything works fine but sometimes (some requests) I don't need to use an ISession (a connection with database). I'd like to know if is there any way to open an ...

Guidance on Database Design for CakePHP

I'm developing an application using the CakePHP framework and am currently in the process of designing the database. I want to make sure that I design the objects and their associations correctly so that the application performs well, is organized properly, is extensible, and scales well. I will first describe the application in detail, ...