orm

Entity Framework or NHibernate

Possible Duplicates: ADO.NET Entity vs NHibernate nhibernate, entity framework, active records or linq2sql Hi all, I'm going to choose a ORM tool for the new project. Just wondering which one is better? Entity Framework or NHibernate? Please give some suggestions according to your own experience. Thanks ...

Control sort order of Hibernate EnumType.STRING properties

Currently, my project uses @Enumerated(EnumType.ORDINAL), so when I sort by this column, it is ordering based on the order in the enum, which works fine. But I need to add some additional values to the enum, which need to be inserted at different locations in the list of enum values and can't be just added to the bottom to maintain the c...

OnDeleteAction cascade fails with constraint violation error

Hibernate 3.3.x @Entity public class User { @OneToMany(mappedBy = "user", cascade = CascadeType.ALL, fetch = FetchType.LAZY) @OnDelete(action = OnDeleteAction.CASCADE) @Cascade(value = DELETE_ORPHAN) @OrderBy private List<Phone> phones= new ArrayList<Phone>(0); ... } Cascade delete is not enabled if you have some ...

how many methods would you have in a ORM DAL

Let's say that in a project your entire domain can be modelled with a single root say "Company". So is it logical then to say that my DAL exposes only 2 methods :- save and delete to the business layer and all other things are done at business layer ?? or is it bad design ?? Context : I am new to ORM and am currently involved in a projec...

Fast, thread-safe Python ORM?

Can you recommend a high-performance, thread-safe and stable ORM for Python? The data I need to work with isn't complex, so SQLAlchemy is probably an overkill. ...

@SequenceGenerator on class annotated with @MappedSuperclass

Hello! I have following structure of my entities: @MappedSuperclass public abstract class BaseEntity { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqGenerator") private Long id; } @MappedSuperclass @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @SequenceGenerator(name = "seqGenerator", sequenceName...

Hibernate saving User model to Postgres

I'm using Postgres via Hibernate (annotations), but it seems to be falling over dealing with a User object: 12:09:16,442 ERROR [SchemaExport] Unsuccessful: create table User (id bigserial not null, password varchar(255), username varchar(255), primary key (id)) 12:09:16,442 ERROR [SchemaExport] ERROR: syntax error at or near "User" I...

Doctrine 2.0 in production

I would like to know if Doctrine 2 Beta 3 is stable enough to use for a production project? Do you have any success stories about it? What about api stability in general, and especially in recent betas? ...

Hibernate Error: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session

Hi folks, I have got almost the same problem like that user. In my situation I load one entity from db, I convert this entity into a DataTransferObject, then I want to edit one attribute, after that I convert it back into an entityObject, then I update that entity and hibernate throws following error: Hibernate Error: org.hibernate.No...

How to save specific properties of a JPA entity model attribute from JSP page

We are using JPA entity beans as our model for Spring MVC controller on a jsp page. One of our jsp pages is a partial view of this entity which does not show all properties. Whenever we try to update our entity using the service layer from the controller only the properties used on the jsp form are persisted and all others are nulled ou...

Hibernate session.get() Problem with UUID string ID

I am having a problem with Hibernate. The primary key of ID in mysql table is UUID style String. e.g.08fe2a75-5d40-4645-896d-aab2a3ac96b8 But I can not use session.get() to fetch out the data for some reason. Software software=(Software)session.get(Software.class, id); It seems ok with integer IDs. Please advise ...

Django: Advice on designing a model with varying fields.

I'm looking for some advice/opinions on the best way to approach creating a sort-of-dynamic model in django. The structure needs to describe data for Products. There are about 60 different possible data points that could be relevant, with each Product choosing about 20 of those points (with much overlapping) depending on its ProductTyp...

Are there any ORM frameworks for Web SQL (javascript)?

Anyone knows if there's one available now or will be in a near future? ...

JPA Best Practice: Static Lookup Entities

Imagine, an Event entity references a Status Entity: @Entity @Table(name = "event") public class Event() { @Id @Column(name = "id", nullable = false) private long id; ... @ManyToOne @JoinColumn(name = "status_code", nullable = false) private Status status; } @Entity @Table(name = "status") public class Status() { @Id ...

Hibernate loading all entities utilizing 1st or 2nd level cache

We have an entire table of entities that we need to load during a hibernate session and the only way I know to load all entities is through an HQL query: public <T> List<T> getAllEntities(final Class<T> entityClass) { if (null == entityClass) throw new IllegalArgumentException("entityClass can't be null"); List<T> list ...

Migrating a custom persistence layer to hibernate3

So, very soon, I will be part of a migration that will move a home-rolled persistence layer (circa any good, popular ORM) to hibernate3. However, at the same time that this migration happens, developers will be working to implement new business logic atop the current persistence layer, hence working against the migration! Does anyone hav...

How would you declare the OneToMany member variable

Which of the following declaration would be the right one to choose for allocating the right amount of memory. Option 1 has an initial collection capacity of 0 and Option 2 has an initial capacity of 10 and Option 3 doesn't declare anything. If the underlying ORM provider loads these object eventually, wouldn't it be using a setEmails(....

Spring/Hibernate: Do you have to load entities to use it after saving?

Hi all, I have a database model with two tables: Session and ScriptExecution which are associated with a one-to-many relationship: public class ScriptExecution implements Serializable { @ManyToOne @PrimaryKeyJoinColumn private Session session; ... } public class Session implements Serializable { @OneToMany(fetch=FetchType.EAGER...

JPQL ORDER BY clause with parameter

I'm trying to write a JPQL Query with an ORDER BY clause: query = "SELECT c FROM item ORDER BY c.name ASC" I would like to set an "order" parameter, whose value would be either "ASC" or "DESC": query = "SELECT c FROM item ORDER BY c.name :order" And then in my implementation: query.setParameter("order", "ASC"); This is when I ge...

hibernate interceptor post save?

i need to intercept post save for an entity in hibernate, but all what i found was on save, which is dealing with the entity before being saved, and there's a postFlush method which return a huge lazy iterator, that i can't understand how to use it, please suggest me a way to catch entity after hibernate save or update, Regards, ...