orm

Deciding between NHibernate vs Entity Framework?

What are the main advantages and disadvantages of NHibernate and Entity Framework 4.0? (While tagging my question, I've noticed more NHibernate tags than EF. Is NHibernate more popular?) ...

NHibernate: Generate mappings for stored procedures

I need to call some stored procedures via NHibernate (not necessarily for CRUD-operations). Is there a freeware/open source tool which can generate mappings (a hbm.xml) for stored procedures and tables? ...

How to choose DDL Primary Key constraint names with JPA/Hibernate

There exists a proprietary hibernate annotation to specify the Foreign Key constraint names that are used at DDL generation time: org.hibernate.annotations.ForeignKey. Is there also a way to specify the Primary Key constraint names? ...

Generating LINQ to DB2?

I have an existing DB2 database at my job. (At least, I think it's DB2. They refer to it as "the iSeries" and it looks and feels like DB2 on some mainframe-ish hardware.) For years the .NET developers in my department have just manually written ADO commands and queries to get specific data from specific tables, etc. At the moment I'm...

Multi ORM solution

Hello, I would like to know what's the best way to develop an multi ORM solution. Until now all the projects I saw are strongly related with the choice of ORM and they stick with it until the end. Nhibernate, Castle ActiveRecord, Linq to SQL, WilsomORM, LLBLGen, SubSonic, Entity Framweork, others... I was thinking if I should or not, ...

Need help understanding Doctrine many to many self referencing code

i am having trouble deciphering this block of code from doctrine documentation /** @Entity */ class User { // ... /** * @ManyToMany(targetEntity="User", mappedBy="myFriends") */ private $friendsWithMe; /** * @ManyToMany(targetEntity="User", inversedBy="friendsWithMe") * @JoinTable(name="friends", ...

DevExpress eXpress Persistent Objects (XPO) via WCF

Hello all DevExpress devs! =) I'm trying to tame Express Persistent Objects remotely. Actually, XPO allows two different approaches - accessing the database directly, and through WebService/WCF. For security reasons, we've chosen second option. Now, WCF wraps database access, and clients must authenticate themselves in order to acce...

Saving parent/child header/line using Doctrine 1.2

I have a simple parent-child/header-line model in my project. The problem is that its creating a cyclic relation or something, and not letting me save the parent without the child! Detect relations is switched off! detect_relations: false ... BillHeader: package: Billing tableName: Bill_Headers actAs: SoftDelete: ~ columns: ...

JPA OneToMany problems after update

I have 2 Classes, Parent and Child, with a @OneToMany relationship. Every parent has 0 or more children. @OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.REMOVE}) The Parent class has also other fields like the name. I'm in a Container env, so my UI is made of JSP. When I want to change the Parent object I have to pass it to a...

What is bltoolkit's BLTgen tool and how it should be used?

I guess it is something like sgen.exe which generates some serialization classes in separate assembly. Is that it? Should generated assembly be referenced? If so, by which project? I have noticed that some LINQ queries are very slow, when executed for first time. Maybe bltgen tool can help? I'll start a bltoolkit blog when I find all t...

Runtime one-way mapping of n tables to 1 class in Hibernate

Hi, I have data in different tables but in the same database, all of which have the same schema. Depending on some runtime variable, I want to choose which table to use when querying Hibernate. Is this possible? Note that I only use Hibernate to read table-data to objects. A solution (I think) would be one *.hbm.xml-file per table an...

CakePHP: Duplicating/Deep Copying a Tree Structure Easily?

Hi all, I am wondering is there an easy way to make a copy of a tree structure that consists of one model with a parent_id that actsAs a tree? I was thinking it should be easy to recursively go through a given tree, remove all ids and lft, rght fields; however, as I add the new fields parent_id won't match up correctly. I suppose it sho...

Fluent NHibernate - Many To One Relation

There is a table of Products and Categories. Many products have one category. So, in Product mapping, how can I write the correct code to map with its category? In Product class: Is it something like: References(x => x.Category).Column........ ...

Problem when persisting Entity

@Entity @Table(name = "jobitems") @IdClass(JobItemId.class) public class JobItem implements Serializable { @ManyToOne @PrimaryKeyJoinColumn(name = "forumId") private Forum forum; @ManyToOne @PrimaryKeyJoinColumn(name = "parsingJobId") private ParsingJob parsingJob; @Id @Column(name = "forumId", insertable = false, updatable = ...

Best ORM for Adobe Air / Flex

I'm not sure what I'm missing here, but I can't find a reliable ORM for AIR. The ones I find are not documented well and don't seem to have a solid following. Is a solid ORM non-existant at this point? Ones I'm aware of: http://flexorm.riaforge.org/ http://code.google.com/p/airorm/ http://code.google.com/p/air-activerecord/ ...

How to create relationship to the same entity with JPA (Hibernate)?

I have an entity User and it should have property manager where manager is another user (one manager can manage many users, any user may have only 1 manager or have not any). How can I implement this? I tried something standard @ManyToOne @JoinColumn (name = ??? /* what should be here? */, nullable = true) private User manager; but ...

JPA - Using insertable/updatable

I am writing a webservice to maintain a database. I am trying to use JPA (EclipseLink) for the entity classes. However, the database uses natural primary keys and therefore there's potential that an update on the ID fields will fail due to foreign key constraints. Our DBA has provided a function to update the ID fields which will crea...

Orphans remain in database even with orphanRemoval=true on one-to-many relationship (JPA/Hibernate)

@Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @Table(name = "company_policies") @DiscriminatorColumn(name = "rule_name") public abstract class AbstractPolicyRule implements Serializable { @Transient private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long id; private String value; ...

What is the use of bag tag in Hibernate?

i need to know how to use the bag tag and what is the purpose? ...

not able to load entity after insertion in toplink

hi, i am using toplink as ORM tool, i am facing one peculiar problem. I am inserting an entity into the session and then in the next line if i try to load the same entity, i am unable to get that, instead it returns me null. But the same issue if i try using hibernate, then it works properly. can any one please help. Address address = n...