orm

@PrimaryKeyJoinColumn with Bidirectional @OneToOne relationship

I have two objects Mat and MatImage, parent and child resp. The primary key of MatImage is the id of Mat and they are join by one to one relationship. If I understand bidirectional relation correctly, the child object would know about the parent if I do something like matImage.setMat(mat). I would think the primary key would be filled ...

Who should establish the relationship? The Entity or the Data Mapper?

There are four classes: StudentBase, CourseBase and StudentDataMapper, CourseDataMapper An Student object can have a relationship with an Course object. One Student can have many courses. One course can be visited by many students. In the ER diagram, a Student entity has an attribute called "courses", but a course does not know anyth...

How to Use Mathematic Equations as Filters in SQLAlchemy

I'm using the SQLAlchemy ORM to construct the MySQL queries in my application, and am perfectly able to add basic filters to the query, like so: query = meta.Session.query(User).filter(User.user_id==1) Which gives me something basically equivalent to this: SELECT * FROM users WHERE user_id = 1 My question is how I would integrate s...

Is there any way to state that a field of an entity class is not a persistent attribute?

The question is in the title. Some explanation: I can't implement necessary mapping. But I can get all necessary data using queries in DAOs. So, I want to insert that data manually to my entity in DAOs findAll () method. But JPA treats all entity's fields as persistent attributes and adds them to generated sql-queries. Of course, I get...

How to create a tagging system with NHibernate (many to many)

I'm learning NHibernate and hoping you guys could help me a bit about Tag Cloud design and solutions. I have 3 tables which are "News", "Tags" and "News_Tags" with Many-To-Many relationship and the "News_Tags" is the link table. Options: cascade="all", cascade="all-delete-orphan" If I delete one of the news records, the it will delet...

Quick to learn ORM for .NET 2.0

I want to throw together a .net website as an interface to a subsystem I manage. I'm planning to use ASP.net (on .net 2.0) because this is the shop's standard. I would like to use an ORM because I was playing with Django a little bit ago and realize the time saver and code simplifier it was. I realize I may not get the time saving as...

How do I get all instances that inherited from the same parent class in django

I have two models than inherited from the same abstract base class. I would expect to be able to get all instances from classes that are children of the base class with something like AbstractClass.objects.all() Of course I could join queries on all children but that's awful and it stops working if I add new children class. Is this p...

Hibernate list operation question

I'm working on a utility to update a list of entities in a database as a group. The database contains a list of entities. The result of the update is a new list. The API accepts this new list. The update may end up modifying some of the entities in the list, creating new ones and deleting some. So at the entity level, I may have to do a...

Hibernate, MySQL Views and hibernate.hbm2ddl.auto = validate

I can use MySQL views in Hibernate by treating them like tables - ie. the entity is no different than one created for a table. However my application won't deploy when Hibernate is set to validate the model as it can't find the View as it assumes it's a table. Is it possible to use Hibernate Entities with deploy time validation turned o...

When and why JPA entities should implement Serializable interface?

The question is in the title. Below I just described some of my thoughts and findings. When I had very simple domain model (3 tables without any relations) all my entities did NOT implement Serializable. But when domain model became more complex I got RuntimeException which said that one of my entities didn't implement Serializable. I...

Desining a system for mutiple input/multiple output

Background I'm sketching on an application that needs to perform something like this database a >--| |--> fileformat 1 database b >--+--> custom application >--+--> fileformat 2 ... | | ... database n >--| |--> fileformat n The databases in questi...

Creating DB using ORM

Is there any C# .NET ORM that can create databases ? It should be capable of creating MS + MySQL + PostGre + Oracle databases at least. And I don't mean tables or schemas, I mean the database only. I use nHibernate, but it can only create tables and schemas, and query/insert but not creating the database itself. ...

Is there any FREE ORM for .NET Compact Framework (Windows Mobile 6.1, SQLServerCE) ?

Looks like I found a good commercial variant, but I'm looking exactly for Free one. Does someone know some? ...

ApplicationException - Java - Hibernate - rollback related

My question is related to Transactions and Exceptions Requirements: I have 10 records to insert into database table. And after inserting every record, I insert data into another table. So if inserting to second table fails, I want to rollback that record. Ex. Say handle cash transfer (from one account to account) for 10 persons at a t...

unit of work in a java 'main' application

I am doing this in each and every DAL method: public static Product GetProductByPartNumber(String partNumber) { Session session = HibernateUtil.getSessionFactory().getCurrentSession(); session.beginTransaction(); Product product = (Product)session.createCriteria(Product.class) ...

looking for a db abstraction/substitute that actually works

i am looking for a form of data storage that will answer a few requirements. i realize these requirements are non-standard, and for now i'm using activerecord and ORM solutions like everyone else, but this is my "holy grail" - if you know of anything like this, i would be eternally grateful: pure PHP multiple repositories, preferably f...

Is it possible to obtain the SQL statements generated by Class::DBI?

I want to find the exact SQL statements that are generated by a Perl ORM package such as Class::DBI. I am not looking for SQL generated for simple inserts and deletes, but for row modifications that result from slightly complicated object manipulations (inserting rows in a table which is a child of a row in a parent table, for example) ...

How to dual license my open source software ?

I am working on an ORM in PHP and would like to dual license it: One open source license for open source projects One commercial license for commercial projects However, I was approached by an organizer of a "coding fest" which wanted to use my project for an open source coding event. I am not sure if it would be smart to let other d...

How do you override a Constant in Doctrine's Models?

In Doctrine you are provided with a Constant Variable that allows you to set a global Identifier column in all of the models that are generated by Doctrine's code. I am trying to figure out how I can override/shut off this value so that it does not create this column in a specific table. The Constant is: ATTR_DEFAULT_IDENTIFIER_OPTION...

.NET ORM solution with class auto-generation: Subsonic, Castle AR, ...?

I used to work with a custom data mapping library, and curently I'm trying to switch to a more widespread ORM solution. After some experimentation, I refined my requirements to the following: able to generate usable classes from database schema (SQL Server support is enough), support for ActiveRecord pattern, programmaticaly configura...