orm

How do you convert numeric types in the mapping from a stored procedure to a complex type in Entity Framework 4?

We have two stored procedures in Microsoft SQL Server that return data that is conceptually of the same type. One returns an ID as SCOPE_TDENTITY() (a numeric), while the other returns 0 (an int32). We have a complex type with a property ID. If this property is a nullable decimal, we receive the following error when enumerating the resul...

Why does eclipselink consume the whole allocationSize each time it's rebooted?

I've just noticed that for my entity's id, eclipselink assigns an id 1 + the previously greated assigned IN THE SAME SESSION (1), as opposed to in the element table (2). This goes against my application expectations. What's the easiest way to tell it to do 2? @Id @GeneratedValue(strategy = GenerationType.AUTO) private int objId; And...

Do ORM's implement encryption?

Typically the model for ORM's that I've used goes something like this: Program startup: Initialize ORM db connection While running: make/modify/delete domain objects, commit changes, rinse and repeat. Program shutdown: commit any uncommitted changes if necessary, disconnect ORM db connection What if someone is sniffing network traffic ...

NHibernate, ORM : how is refactoring handled? existing data?

When using an ORM (specifically NHibernate), how is refactoring of data handled? I mean, if data objects change such that the underlying relational DB schema changes, does the ORM offer any help in schema upgrades / downgrades in the DB? How about migration of existing data to the new schema? I am in the process of making a decision on ...

How can I do this complex SQL query using Django ORM? (sub-query with a join)

I'm used to writing my own SQL queries and I'm trying to get used to the whole ORM thing that seems to be so popular nowadays. Here's the query: SELECT * FROM routes WHERE route_id IN ( SELECT DISTINCT t.route_id FROM stop_times AS st LEFT JOIN trips AS t ON st.trip_id=t.trip_id WHERE stop_id = %s ) where %s is an intege...

Run code after Hibernate updates database schema?

Hi Is there a way to register some kind of SchemaExportEventListener (that's a name I've chosen) with Hibernate, so that after it has generated the DDL we can make some updates (which Hibernate doesn't support) to the database? We need to set a case-insensitive unique constraint on a PostgreSQL column, and while this is perfectly possi...

Are many-many relationships to be avoided and if so, what is the alternative?

I was left a comment that many-many associations are to be avoided, but I cannot find the original comment/user who left me this info. So I'm asking the community, are many-many associations to be avoided, if so why, and what is the alternative? example: A restaurant offers many types of burgers which can be dressed with many different...

Stateless ORM for SOA

Hi, We need to implement a .NET WCF service that will be a part of a SOA solution, which means it's entities will pass through and be changed by both Java & .NET based services, and also on Desktop clients (though they will probably be .NET, but it shouldn't matter). In order to achieve this flexibility, all objects have to be stateles...

SQLAlchemy equivalent to Django's annotate() method

I'm doing a join like this in SQLAlchemy: items = Item.query\ .outerjoin((ItemInfo, ItemInfo.item_id==Item.id)) items.add_columns(ItemInfo.count) This causes SQLAlchemy to return tuples: >>> items.first() (<Item ...>, 2) I'd much prefer it if the "count" value would instead be returned as an attribute of the item, i.e. I wa...

what are the fastest java tools to generate CRUD screens from a DB schema?

I am constantly in search of better and faster java tools to prototype webapps. I generally start with a good data model on the backend, and work towards the screens. What are some good tools that I might not know about that can be used to quickly generate functioning CRUD screens. ...

What ORMs are capable of building up an entity from tables belonging to several physical data sources?

I am checking if I can use Entity Framework or NHibernate to build a conceptual model where fields of some classes are mapped from different physical data sources. EF looks promising, at least on paper: this blog post mentions that "you can mix and match a number of different database vendors, application servers or protocols to design ...

LLBLGen Pro with Entity Framework 4?

Hi All, I am doing a small study about what ORM to use for our next project. I have narrowed down to LLBLGen Pro / EF4. My question is: I am more convinced about EF4. Should we use EF4 alone or should we purchase LLBLGen Pro and select EF4 as target framework? Are there any advantages/disadvantages in doing so? Any guidance/pointers...

how to use regular expression in EJB named query

I have query in mysql like SELECT COUNT(DISTINCT MOBILE) FROM TBLM_CUSTOMER WHERE MOBILE NOT REGEXP '^00*0$' AND LENGTH(MOBILE) >= 10; I am using EJB 3.0 and I want to make same query using NamedQuery, same thing is possible using createQuery , but i want to use NamedQuery. Is it possible to use regular expression using NamedQuery in...

Kohana 3 ORM as_array return array of ORM

Hi, I'm executing a simple query and want to get an array back. Based on the ORM tutorial that comes with the Kohana 3 guide, I thought I could do the following: ORM::factory('user')->find_all()->as_array(); But that seems to give me an array of model objects (ie array( User_Model1, User_Model2 ... Looking at the source I see I can e...

Why is hibernate deleting rows from join table when adding element to set mapping many-to-many?

Suposse I have two classes: class A { Set<B> bs } class B { } This mapping: <set name="bs" table="bs_tab" cascade = "save-update"> <key column="a_id /> <many-to-many column="b_id" class="B"/> </set> And join table like this: bs_tab( a_id, b_id, primary key(a_id, b_id) ) When I add some element to bs set a...

JPA QL - "winning bids of a user"

Hi, I have a simple app with User, Bid, and Auction, the relationships are clear I hope. Now I want to implement getWinningAuctionsOfuser( User u ), which would return the auctions which the given user is currently winning. I know how I would do this in SQL, but I don't have much experience with JP-QL. What's the best approach? Curr...

Best practice in ColdFusion ORM

A question of ColdFusion ORM We are using ColdFusion 9 for the past 6 months and while we've used some of the new features, ORM is something we've avoided because we usually work on the same very large website. Over the years we've used Apache OBJ but then we moved back to CF and used our own DAO objects generated from tables to handle ...

EF4 Code Only - Map Columns to Property Complex type

Hi, I have a table like this: Name Tree Iron Clay Added I want to map it to a model like this: Name Resources Tree Iron Clay Added In makes sense to map it like this, when working with it in my program, but doing it that way in the databse would just make it more complex ... not would not add any useful things. Is it possible...

Doctrine ORM, two different querys produce the same result set

I'm using Doctrine 1.2 and Symfony 1.4. In my action, I have two different query that return different result set. Somehow the second query seem to change the result (or the reference?) of the first one and I don't have any clue why.. Here is an example: $this->categories = Doctrine_Query::create() ->from('Categorie AS c') ...

Does SQLite work well with Entity Framework?

The reason I ask is because when trying it out, this happens: http://stackoverflow.com/questions/4064814/argumentexception-was-unhandled Both the Data Access Library project and the actual Winforms project use .NET 3.5 and there's this bug that rendered everything to a screeching halt. Maybe I shouldn't use an ORM with SQLite and just...