orm

Hibernate Left Outer Join problem: path expected on join

I have two tables, something like: Article and ArticleRelevance They have a one to one relationship, and ArticleRelevance is optional, meaning a Article may (or may not) have a ArticleRelevance. I want to select all articles along with the ArticleRelevance details. With traditional SQL, I will do a outer join on the tables, like SEL...

How to Queue The Add Operation in NHibernate?

Hi guys, Is there some way to queue the "Add" operation in NHibernate, just like Linq to SQL and Entity Framework does? I want to add an entity to the repository, but I don't want to save it to the database immediately, because the business logic is complex. I want to submit all changes when I call ITransaction.Commit(), just like Ent...

object-relational mapping

Hi, I need to store an instance of an complex datatype into a relational database. Is there a way to do this without moddeling the database structure first, like it is done in ado.net? The database (or table) structure should be created from the class structure. The class has some properties like ints, strings or bools but could also ha...

Positional Parameter with IN clause in JPA

I'm trying to evaluate the following JPQL query: select err from Error err where err.errType = ? and err.msg in (?) The err.msg is a relationship to an Object derived from a class called CSMessage. So I do something like this: ...fetch my CSMessage from the DB. This part actually works... List<CSMessage> msgList = new ArrayList<CSM...

How can I use DataContext class to establish a connection to Oracle Database?

Is it possible to use the DataContext class to connect to an Oracle DB? I am reading some examples on MSDN I need an example where the context is used to connect to Oracle. ...

Using PHP and Kohana 3, can one recursively find and output any model's relationships?

Let's say we have a User Model that has many Posts. The Posts Model has many Categories The Posts Model also has many Comments. How do we find dynamically, the relationships that the User Model has? The idea is to make an admin backend to a site, where I can have one function, that when passed a model, can retrieve all data related t...

Is it possible to get design-time code completion for dynamic types?

I'm looking into generating types dynamically, ie. TypeBuilder, Reflection.Emit.. Is it ever possible to get design-time code completion for such created types? i.e typename recognition, list of properties after typing "obj1." and such. Full Context: Trying to generate entities and data access objects corresponding to database tables in...

Build NHibernate ORM from Oracle database

Hi there, I'm analyzing a project in asp.net with mvc and would like to use NHibernate as ORM. All over the net I find books, tutorials, quick start guides to work with SQL and Linq-to-Sql but allmost never for Oracle. What is the best setup? In my project we have a rather small database in Oracle and I prefer to have model that is cr...

EclipseLink: don't fetch some fields by default

Let's say we have an entity @Entity public class Person { @Id int id; @Basic String name; @Basic String remark; } Let's say "remark" field is filled with big texts, but rarely used. So it would be good if when you run jpql: SELECT p FROM Person p, EclipseLink just executes sql select id, name from person And than when you...

Doctrine Class Inheritance in XML

I'm trying to setup class inheritance using the Doctrine 2 ORM, but am getting errors (even when following their examples). I'm using the console from a Symfony 2 sandbox. The simple example uses the classes Person and Employee; An Employee extends Person. The error I'm getting when trying to generate the entities is: [Doctrine\ORM\M...

EclipseLink/JPA: Multiple @DiscriminatorColumn annotations for Entity

I'm looking for a way in EclipseLink to have two @DiscriminatorColumns on the same entity My PostreSQL DB table is: Dictionary { id, object_type, attribute_type, translation } And classes are: @Entity @Table(name = "dictionary") @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="object_type", ...

How to create basic pages with Symfony and Doctrine

Hello, I'm completely new with Symfony and Doctrine. I have generated a project with a the Doctrine ORM, my database schema is fully well generated. Now I just want to create basic services (in simple .php pages) that do some actions according to parameters in a HTTP POST request. I tried to create an app through the generate:app comma...

getting result set into DTO in SQL Query in Hibernate

I have a query like below select f.id, s.name, ss.name from first f left join second s on f.id = s.id left join second ss on f.sId = ss.id If I could have used HQL, I would have used constructor syntax to directly populate DTO with the result set. But, since hibernate don't allow left join without having an association in place I have...

Problem with persistence

I'm using EclipseLink in my J2SE project. I'm using mysql and JPA. I have a simple entity with primary key and String field. I can read from database using EntityManager#createQuery but when I try to persist or merge entity nothing is put in database and no exception are thrown. I can insert data manually without problems (using same cre...

How can I change the name of the self-referential many-to-many set using hibernate.reveng.xml?

I have a project using Hibernate on an Oracle database for which all entities are generated directly from Hibernate Tools under control of a hibernate.reveng.xml file. I have one class which has a many-to-many relationship to itself using an intermediary table, like so: PERSON: ID ... PERSON_PERSON: PARENT_ID --> PERSON.ID CHI...

Database Design - Should one-to-one relationships be avoided?

Possible Duplicate: Is there ever a time where using a database 1:1 relationship makes sense? For the sake of simplicity, I'll ask the question straight out: should one-to-one relationships in database design be avoided or this acceptable? I know all of the attributes of this "item" can be all hosted in ONE table, but I fee...

How do I select the nth element in a Collection by the number in an @IndexColumn?

I have an ItemEntity class, which has a collection of ImageEntity's. I want to be able to fetch a specific ImageEntity, given its index in the collection. For example, for an ItemEntity with 10 ImageEntity's, I want the 4th ImageEntity in as few database hits as possible. I've read Hibernate In Action and googled, but every piece of d...

Kohana ORM: Get results based on value of a foreign table

Hello. I have two tables: taxonomies -id -name taxonomy_type -taxonomy_id -type_id I've configured two models: class Model_Taxonomy{ protected $_has_many = array('types'=>array()); } class Model_Taxonomy_Type{ protected $_belongs_to = array('taxonomy' => array()); } *Please note that taxonomy_type is not a pivot table.* A ta...

NPE in HQL subquery

I have an error in the following HQL Query: em.createQuery( "SELECT new com.magenta.sovereign.entity.view.ThirdPartyReportView(" + "e.id, " + "e.vehicleRegistrationNumber, " + "e.driverName, " + "e.thirdPartyAssignee.firstName, " + ...

Entities Framework 4 Code First: Business Methods

Could anyone tell me where is the best place to put my business methods when using EF4 code first POCOs? Should they go in the POCO class? E.g. public class customer public property Id as int32 public property Name as string public property Archived as boolean public sub MarkAsArchived me.Archived = true end...