orm

What's the best way to abstract the database from a PHP application?

My question is how does one abstract a database connection from the model layer of an application? The primary concern is to be able to easily change from different types of databases. Maybe you start with a flat file, comma-delimited database. Then you want to move to a SQL database. Then later you decide an LDAP implementation would be...

Hibernate polymorphism: instantiating the right class

I'm new to hibernate, as you'll soon see. I apologize if this question has an easy answer, but I'm just not familiar enough with all of the terminology to find it easily. Let's say I have a base class "A" and one subclass "B" that I'm mapping with Hibernate, perhaps using the table per subclass strategy. The base class is not abstract...

Question about the benefit of using an ORM

I want to use an ORM for learning purposes and am try nhibernate. I am using the tutorial and then I have a real project. I can go the "old way" or use an ORM. I'm not sure I totally understand the benefit. On the one hand I can create my abstractions in code such that I can change my databases and be database independent. On the ot...

ADO.NET Entity Framework and a Joined Subclass

Can you do a Joined Subclass in the Entity Framework version 1? How do you approach the issue? Joined Subclass: http://www.xylax.net/hibernate/joinedsubclass.html http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/hibernate/Hibernate_Reference_Guide/Mapping_declaration-joined_subclass.html ...

Fowler Data Mapper Object Creation

I have been utilizing the Fowler patterns for domain models with a Data Mapper and have run into some confusion on how to implement the creation portion of CRUD. I can't utilize existing ORM technologies as the underlying data sources are custom systems. The area that’s troubling me is how to call the underling ORM when I need to create ...

Java, Code Generation, and Persistence Frameworks

Are there any Java code generation persistence frameworks? Something that is "database first" rather than object model first? I know this is probably heresy in the Java world, I'd just like to know if any frameworks like this exist. I'm more of a .NET guy these days. So on the .NET-side tools like .NET Tiers or CSLA come to mind. ...

Magento ORM Documentation

Outside of the source code, is there any extensive documentation on the Magento ORM? I get the basics, and can usually dig through the Mage code base, litter it with Mage::Log calls and figure out something that works, but my efficiency would go way up if I had a high level overview of how the models are intended to be used. How do the...

yet another Data Access Layer ( c# .net 2.0)

Realised I am writing yet another code generator to do the sps/classes/interfaces etc for a simple ORM layer. This time most of the guts are in SQL. I have a general-purpose C# DAL for calling sps/getting results etc. (took me all of an hour or so and is tiny). I thought for sure there'd be an easier way by now... is there? I am confid...

What's the best way to talk to a database while using Sinatra?

As I understand it, the Sinatra framework, unlike Rails, does not provide an ORM. In that case, how do you talk to a DB in a Sinatra app? Or is Sinatra only for apps that don't use a DB? ...

Reverse engineer DDL from JPA entities

I'm playing around with some JPA stuff, changing the mappings to see how they're supposed to be etc. It's basic experimentation. However I can't find a tool that will simply read my entities and then generate the table schema for me. I tried to find something like this in JBoss tools but nada. Eclipse integration will be a huge plus but ...

Relational database management system vs object database

Hi, I'm a research assistant for a university. We're retooling our Software Architecture subject, hoping to "modernize", and address some of the teaching and collaborative learning issues we've discovered in past semesters. Students are asked to rapidly build a prototype of their architectured system using Eclipse. For persistence, we...

Does an ORM integrate with existing applications or do I not understand?

Assume Hibernate for the ORM. I'm not sure how to ask this. I want to build an application that can replace part of another. For example, say I have an application with various modules, called the "big" app. This application may handle HR, financial, purchases, skill sets, etc. But maybe, for whatever reason, I don't like the skill ...

NHibernate Projection to DTO

Hello, I am unfamiliar with NHibernate projection. I am attempting to use it so I can return a List<> rather that an IList<>. I am not having much luck with projecting to the DTO as of yet. I have the following query and Domain objects. So to begin I am just trying to get a list of Orders given an EmployeeID. I am looping through the re...

Splitting Hibernate Entity among 2 Tables

I have a simple Class Hierarchy that I am trying to get to work with Hibernate/JPA. Basically what I want is for the MovementData to be in its own Table with a FK to the integer id of the Main Vehicle Table in the Database. Am I doing something wrong? How else can I accomplish something similar? I am pretty sure I am following the JPA...

Do you think of the database or objects first when building applications?

When you think about building an application, say for the web, and it uses a relational database, do you think about the database first and then putting you app as a front end or do you think of your program and objects and how a database can store those. I'm trying to change the way I think but it hasn't clicked (I'm not sure I'm even ...

DB/Entity Design: table related to any one of multiple tables

A Report can have multiple charts. The Chart table looks as follows: Chart -- Id, ChartId, ReportId, ... The ChartId above can map to the ChartId to either one of the following Chart Types: Line: ChartId, Thickness, YAxis, XAxis, Color, ... Pie: ChartId, Radius, Color, ... Bar: ChartId, Width, Color, Border, ... I am using SQL Se...

Null key in Identity Map

I have a domain object used in an identity map (the keys are the object's Id property). Pseudocode: map = new Mapping(); map[domainObj.Id] = 'foo'; I observe the object to tell me when it has been saved to the database: domainObj.bind('saved', function() { map[domainObj.Id] = 'new foo!' }) For new objects the Id field is empty...

ORM framework/architecture which supports converting class definitions to dataset definitions in .NET

As part of a system which I am developing I need a method of taking a set of class definitions which define an object model and constructing a dataset from them which can then be populated by instantiating instances of the classes (either singletons or through collections for multiple table rows). The kind of approach I had in mind woul...

Django m2m queries, distinct Users for a m2m relationship of a Model

Hi, I have a model Model with a m2m field : user = .. fk user ... watchers = models.ManyToManyField(User, related_name="boardShot_watchers", null=True) How do i select all distinct Users involved in this watchers relationship for all my entries of type Model ? I dont think there is an ORM way to access to intermediary M2M tabl...

Should Business Logic objects have knowledge of their LINQ-to-SQL data objects?

I've looked at several similar questions but I didn't see any that directly applied to me, so forgive me if this is a duplicate. For separation of concerns I'm trying to somehow map my business objects with logic to the LINQ to SQL data objects in the .dbml file (fairly new to this btw). What its looking like though is that my business...