orm

hbm files in hibernate

i am working on some updation in Hibernate application. in which Struts and Spring used. we do entries of .hbm file in configration file(.cfg file). but when using spring with hibernate app we do entries in application context.xml. but i can not find configration entries in entire application. Is there any other class where we configure...

Hibernate: how to fetch only not-logically deleted objects

Nearly every table in our database has a FK to the Auditing table which logs created, updated and deleted status (date and username). We mapped the auditing table to the Auditing class and use it like this: @MappedSuperclass public class BusinessObject extends DataObject { private static final long serialVersionUID = -114781101039594...

JPA with Hibernate 3 - ManyToMany-Stack overflow and Multiple bag errors

I am facing issues while retrieving data for entities having bi-directional many-to-many relationship. If I use List for storing entities, I get unable to fetch multiple bags simultaneously error. If i change my code to use Set, I get stackoverflow error. Details : Spring 3.0.3 Hibernate-core : 3.5.1-Final Hibernate-annotations : 3.5....

Hibernate: association refers to an unmapped class

Hi, I have three tables (DEVICES, DEVICE_DETAILS and LOCATIONS) which I want to map to two classes (Device and Location). To do this I use the following hibernate mappings: Device.hbm.xml: <hibernate-mapping> <class name="bo.Device" table="DEVICES"> <id name="deviceId" type="int"> <column name="NR"/> <generator cl...

Concurrency issue in JPA and JTA

Possible Duplicate: concurrency (stale data) problem in JPA Sorry for duplicating, but I think I didn't get satisfactory answers so posting again Let's say I have methods with following signature Object getData(int id) { //create a entity manager //get data frm db //return data } updateData() { Object obj = getData...

Magento get a product collection in an arbitrary order

I have developed a custom search engine for our Magento store and I am trying to load the product collection in a very specific order (I have ranked the results according to an algorithm I designed). I can load the product collection correctly, however it is not in the order that I would like it to be in. Here is basically how it is wor...

Hibernate Exception

org.hibernate.hql.ast.QuerySyntaxException: cannot dereference scalar collection element: cspName st.append("SELECT customers.name,sum(csp.cspValue) as TotalMoney "); st.append("from Account as account "); st.append("left join account.CSPFields as csp with ((account.accountID=csp.id) and (csp.cspName = 'Target')...

report generation using zend + mssql server + doctrine ORM

Hi All, I want to create report (.csv) using Zend + Doctrine ORM + MS Sql Server. Can any help on this. Thanks in advance. Raja ...

LINQ-to-Entitites: How to do effective lazy-loading (not 1+N selects)?

Short version: Starting with a List of entities and needing all dependent entities through an association, is there a way to use the corresponding navigation-propertiy to load all child-entities with one db-round-trip? Ie. generate a single WHERE fkId IN (...) statement via navigation property? Long version: I am generating a report fro...

JPA 2.0: count for arbitrary CriteriaQuery?

I am trying to implement the following convenience method: /** * Counts the number of results of a search. * @param criteria The criteria for the query. * @return The number of results of the query. */ public <T> int findCountByCriteria(CriteriaQuery<?> criteria); In Hibernate, this is done by criteria.setProjection(Projections....

Doctrine : Lazy loading properties

It looks like when I forget to put leftJoin in my queries, Doctrine will lazy-load relations after I pick them. Ie if I do something like: $property = PropertyTable::getInstance()->createQuery('o') ->leftJoin('o.Features f') ->execute() ; I will still be able to access $property->Attraction , even if I didn't load them in this que...

Propel ORM data fixtures

If I have a yml data fixture file called mydata.yml User: anonymous: nickname: anonymous first_name: Anonymous david: nickname: david first_name: David How do I tell propel where to find this file. Do I need to add any instructions to the build.properties and how do I run it to insert the data into the database ...

Which is the most popular O/R-Mapper for .Net as of 2010?

I am not talking about performance or price. I am talking about popularity. Which is the most popular O/R-Mapper for .Net as of 2010? Which would be the most popular O/R-Mapper for .Net for years to come? ...

ColdFusion EntityLoad Filter

How would I in ColdFusion add <= in my Filter Criteria. I was trying this EntityLoad("Entity",{someProperty <= value}); but with no luck ...

Using Django ORM outside of Django throws ImportError on assigning to the FK

When using the Django ORM from an external shell, using a model with a ForeignKey field an ImportError is thrown when assigning to it. And here is a paste of my shell sessions both from ./manage.py shell and from normal python shell. bradyrj@machine:~/workspaces/django/shellgame$ python manage.py shell Python 2.6.6 (r266:84292, Sep 15 ...

Do ORM frameworks take care of / suggest indices on the DB tables?

I haven't gotten into ORM frameworks much yet, and could use some input from experienced practitioners. Some of these questions may be naive. Please bear with me. In mapping objects to relations, do these frameworks also suggest indices that may be necessary for the queries to execute efficiently? The queries generated by ORMs, are the...

Hibernate v3.6 : Issue with the EntityManager method "refresh"

Hello, The following code throws an exception when invoking "em.refresh(p)": 1: EntityManager em = emf.createEntityManager(); 2: em.getTransaction().begin(); 3: 4: Product p = new Product("J&D", 35.0,"Whisky"); 5: em.persist(p); 6: 7: em.refresh(p); 8: em.getTransaction().commit(); 9: em.close(); When debugging the code, we see that ...

CakePHP - How I could receive related object?

I am trying get all commments relateed to my current post, I am doing it as following: $this->Post->Comment->find('all', array('conditions' => array('post_id' => $id))); but in my opinion, it is a little uncomfortably. Why I should give post_id? Isn't it obvious that I want Comment related to current Post? ...

how to set limitation in EntityManager (JPA) L1 or L2 cache size

hi How to set L1 or L2 cache size-limitation. I concern of increasing the cache-size. One way is defining timeout for cache but i want to know is it possible to make a constraint for cache size or not? RGDS Navid ...

ORM or straight SQL?

Possible Duplicate: Using an ORM or plain SQL? Would you elect to use an ORM or some kind of home spun DAL? And why? The advantages of an ORM seem obvious - better structure / organization, better language fit etc. But I worry about performance issues. Anyone have war stories to share? Any insights on not so obvious risks or ...