orm

IBM Websphere JPA configuration - how to update persistence.xml

I'm new to EJB 3 and the JPA. I've created a datasource in the appserver which is jdbc/AppDataSource. The default persistence provider is left as com.ibm.websphere.persistence.PersistenceProviderImpl. And I left the default jta data source JNDI name as AppDataSource itself. I'm actually confused regarding JTA and non-JTA. What different...

session.connection() deprecated on Hibernate?

We need to be able to get the associated java.sql.Connection of a hibernate session. No other connection will work, as this connection may be associated with a running transaction. If session.connection() is now deprecated, how am I supposed to do that? Thanks, -Sergio ...

Hibernate HBM one-to-many

I have a one-to-many relationship and in my HBM I want to include the association for delete purposes. How can I express that without query/loading the related table/object? Just including a bag or another collection is the obvious answer, but is there something else? Hibernate 2.2 ...

entityManager.persist(user) -> javax.persistence.EntityExistsException: User@b3089 is already persistent

// lookup existing user & set a currently null child entity (ContactInfo) user.setContactInfo(contactInfo); // update the user in the datastore with newly created child Entity entityManager.persist(user); Generates exception: javax.persistence.EntityExistsException: User@b3089 is already persistent Since the user alrea...

Using CF9 ORM for listing pages: HQL or SQL?

I have an ORM mapping which has: magazine object with a many-to-one relationship to a genre and a one-to-many relationship to issues I have an admin page which displays a listing of basic magazine info, the magazines genre (looked up from the linked genre object) and the number of issues currently stored. It all works fine simply usin...

PHP: Choosing ORM for future expansion and changes?

Hi everybody, I come from a Codeigniter MVC background that we've been working with for some time now. It's time to roll our own framework for a big project, but we have come now to the Database part and got a bit confused immediately. In Codeigniter, we've used the ActiveRecord for all SQL database connections, which has worked well, b...

Magento resource model filter and limit

Hi when getting a resource model in magent using Mage::getResourceModel i can add filters no problem but how can i limit the result set to say 5 or 10? ...

Where can I get Linq for NHibernate?

Where can I get the current Linq provider for NHibernate? I am also using the current release of Fluent NHibernate (1.1). Will the current Linq provider (once I find it) play nicely with fluent? ...

Do you use data mappers with MongoDB?

I've been diving into MongoDB with kind help of MongoKit and MongoEngine, but then I started thinking whether the data mappers are necessary here. Both mappers I mentioned enable one to do simple things without any effort. But is any effort required to do simple CRUD? It appears to me that in case of NoSQL the mappers just substitute one...

How do you escape sql data in CakePHP?

For some reason the AppModel->updateAll() method does not escape data passed to it. Looking over the documentation though, I can't find anything on how you actually escape data with CakePHP. Down in datasources/dbo/dbo_mysql.php I found the value() method that seems to just use mysql_real_escape_string() - but I have no idea how to acce...

Primitive or wrapper for hibernate primary keys

I've been looking at various hibernate tutorials and samples, for their identity/primary key property, some use a Java primitive type, some uses the wrapper type, that is; private int id; vs private Integer id; Why and when would I use one over the other, for the entity key ? ...

Cannot create new Django model object within Ajax post request

This is kind of "I already lost x hours debugging this" kind of problem/question :( Following jQuery js code is initiating POST request upon button click $("#btn_create_tag").click(function(evt) { $.post("/tag/createAjax", { tagname: $("#txt_tag_name").val() }, function(data) { } ); }); Django code that is per...

(1+N) selects with OnetoOne associations

Considering the following model: @Entity public class User { @Id @Column(name = "USER_ID") private Long userId; @Column(name = "FIRST_NAME") private String firstName; @Column(name = "LAST_NAME") private String lastName; @OneToOne @PrimaryKeyJoinColumn private UserExt userExt; ... //getters...

Death of the Repository?

I have been hearing a lot about the death of the repository pattern. People using listen when such influential people such as ayende: http://ayende.com/Blog/archive/2009/04/17/repository-is-the-new-singleton.aspx speak. This is a direction which i really don't understand and hence my post. Maybe i don't get the point because of my li...

DAL. Modelling data constraints best practice

Data stored in relation database with data constraints (for example maximum string property length). Clients use Data Access Library (DAL) to manage the data in ORM manner (repositories + data domain classes) Where would you personally implement constraints? For example: Data domain classes: class Person { private string _name; publ...

JPA Inheritance entitymanager.find produces ClassCastException

Hi, I have a class hierarchy like this: @Entity @Table (name="call_distribution_policies") @Inheritance (strategy=InheritanceType.JOINED) public class CallDistributionPolicy implements Serializable, Cloneable{ ---------------- } @Entity @Table(name="skill_based_call_distribution_policies") public class SkillBasedCallDistributionP...

Are Hibernate filters only applied after the data has been loaded from db?

I've found some contradicting information on the net. Does anyone know whether Hibernate filters affect the generated sql, or is it just filtering the data as it's read from the database? Thanks! ...

Doctrine2: Best way to handle many-to-many with extra columns in reference table

I'm wondering what's the best, the cleanest and the most simply way to work with many-to-many relations in Doctrine2. Let's assume that we've got an album like Master of Puppets by Metallica with several tracks. But please note the fact that one track might appears in more that just one album like Battery by Metallica does - three albu...

Hibernate - map object that belongs to two other objects (object with 2 parents).

I'm having a bit of trouble mapping the following: public class Operation { private Integer id; private String name; private List<Item> items = new ArrayList<Item>(); //set/getters/hashcode/etc. omitted public void addItem(Item i,Operation end) { i.setOperationStart(this); i.setOperationEnd(end}; items.add(i); ...

Propel: negate multiple conditions

I need to negate multiple conditions at once using Propel. E. g. a corresponding sql condition is: WHERE !(something = 'a' and someOtherThing = 'b') I couldn't find a way to solve this using Propel ORM. Is there a way to build this query with the Criteria-API that Propel 1.3 provides? ...