orm

How can I avoid setting some columns if others haven't changed, when working with Linq To SQL?

In LINQ to SQL, I want to avoid setting some columns if others haven't changed? Say I have dim row = (From c in dataContext.Customers Where c.Id = 1234 Select c).Single() row.Name = "Example" ' line 3 dataContext.SubmitChanges() ' line 4 Great, so LINQ to SQL fetches a row, sets the name to "Example" in memory, and generates an upda...

How can I force a property of an object to be output as a string when returned as JSON

I'm storing color values as HEX in my database, which is mapped via ORM settings in CF9. When my color values are entirely numeric (e.g. 000000), ColdFusion is serializing them as numbers (e.g. 0.0) when returned from my CFC as JSON. Is there a way to force these columns/properties to be serialized as strings? ...

ORM Against a Service-Wrapped Data Source

We are tasked with migrating an existing set of entities (currently POCOs persisted with NHibernate against an MSSQL database) to now persist to some kind of web service (yet to be built, either RESTful or SOAP-based, and that we control). I like how NHibernate encapsulates the persistence concerns and lets us maintain a logic-rich, per...

Can DataObjects.NET support SQL identity columns?

While there's lots to like about DataObjects.NET, I've found help resources to be a lean, and can't find a solit example of using DataObjects.NET with RDBMS generated primary keys. It would seem as though D4O won't do inserts against SQL Server unless it's in controll of the key. Has anyone solved this in the wild? ...

How to use SQLAlchemy to dump an SQL file from query expressions to bulk-insert into a DBMS?

Please bear with me as I explain the problem, how I tried to solve it, and my question on how to improve it is at the end. I have a 100,000 line csv file from an offline batch job and I needed to insert it into the database as its proper models. Ordinarily, if this is a fairly straight-forward load, this can be trivially loaded by just ...

Manual Linq to SQL entity framework mapping

I've been playing with the O/R designer in VS and I was wondering if someone could shed come light on this. I'm used to OR mappers that are largely manual (homegrown and e.g., NHibernate). I don't mind encoding the entity classes myself, since they don't change all that often to begin with, and I have this irrational fear of designers an...

What is the 'noreq' Filter Type an Alias for?

I'm looking in to Magento's filtering options (Ecommerce System and PHP Framekwork with an expansive ORM system). Specifically the addFieldToFilter method. In this method, you specify a SQLish filter by passing in a single element array, with the key indicating the type of filter. For example, array('eq'=>'bar') //eq means equal arra...

PHP: tips/resources/patterns for learning to implement a basic ORM

I've seen various MVC frameworks as well as standalone ORM frameworks for PHP, as well as other ORM questions here; however, most of the questions ask for existing frameworks to get started with, which is not what I'm looking for. (I have also read this SO question but I'm not sure what to make of it, and the answers are vague.) Instead...

Which O/RM tool supports Microsofts Access?

For one of my clients I'm currently building an application that communicates with a legacy Microsoft Access database. Migrating to SQL server is unfortunately not (yet) an option. I currently write the queries using OleDbConnection, OleDbCommand and –good old- text based queries. As you can imagine I'm a bit spoiled by using modern O/RM...

FluentNHibernate Many-To-One References where Foreign Key is not to Primary Key and column names are different

I've been sitting here for an hour trying to figure this out... I've got 2 tables (abbreviated): CREATE TABLE TRUST ( TRUSTID NUMBER NOT NULL, ACCTNBR VARCHAR(25) NOT NULL ) CONSTRAINT TRUST_PK PRIMARY KEY (TRUSTID) CREATE TABLE ACCOUNTHISTORY ( ID NUMBER NOT NULL, ACCOUNTNUMBER VARCHAR(25) NOT NULL, TRANSAMT NUMBER(38,2) NOT NULL PO...

Kohana-v3 ORM parent relationship

Hi all, I just started with the version 3 of the Kohana Framework. I have worked a little with the $_has_many etc. Now I have the table pages. The primary key is pageID. The table has a column called parentPageID. Now I want to make a ORM model who, when accesed like this $page->parent->find() returns the page identified by parentPageI...

Do you use enums in your data applications and how?

My practice shows that a general enterprise application has a lot of entities which's nature corresponds to an elementary enumeration. For example We may have an Order entity which may have such fields as "OrderType", "OrderStatus", "Currency", etc. referencing corresponding Entities which are nothing more than just a textual name bound ...

Kohana 3 ORM: How to get data from pivot table? and all other tables for that matter

I am trying to use ORM to access data stored, in three mysql tables 'users', 'items', and a pivot table for the many-many relationship: 'user_item' I followed the guidance from http://stackoverflow.com/questions/1946357/kohana-3-orm-read-additional-columns-in-pivot-tables and tried $user = ORM::factory('user',1); $user->items-...

What are alternatives to standard ORM in a data access layer?

We're all familiar with basic ORM with relational databases: an object corresponds to a row and an attribute in that object to a column, though many ORMs add a lot of bells and whistles. I'm wondering what other alternatives there are (besides raw access to the data). Alternatives that just work with relational databases would be great,...

@Basic(optional = false) vs @Column(nullable = false) in JPA

What's the difference between @Basic(optional = false) and @Column(nullable = false) in JPA persistence??? ...

How to convert slightly different tables?

Is there a way to convert table entries from an old table to a new one using the same entity class? To be specfic, here are my entity class' annotations for the new table: @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "benutzer_id") private Integer benutzerId; @Basic(optional = false) @...

Match entities fulfilling filter (strict superset of search)

I have an entity (let's say Person) with a set of arbitrary attributes with a known subset of values. I need to search for all of these entities that match all my filter conditions. That is, given a set of Attributes A, I need to find all people that have a set of Attributes that are a superset of A. For example, my table structures loo...

Java: JPQL select statement

select x from X x where x.a.id = :a_id --> Always 0 objects selected Why does the above JPQL statement not work, but the one below work? select a from A a where a.id = :a_id --> a_obj select x from X x where x.a = :a_obj --> Always correct number of objects selected Neither query throws an exception during execution, but a different n...

ORM framework that extends base class with database-implementation.

I have a game consisting of a client / server + a webpage. A central notion in both client and game-/webserver is an Account. Accounts are stored in a database thus I'm in need of some ORM and recently had a look at Hibernate and Cayenne. My understanding however, is that both frameworks provide an "DatabaseBackedAccount"-class which I...

proper Django ORM syntax to make this code work in MySQL

I have the following django code working on an sqlite database but for some unknown reason I get a syntax error if I change the backend to MySQL...does django's ORM treat filtering differently in MySQL? def wsjson(request,imei): wstations = WS.objects.annotate(latest_wslog_date=Max('wslog__date'),latest_wslog_time=Max('wslog__time'...