orm

Why will Doctrine ORM will not create SQL query for my 1-to-many model??

I know this has to have an easy answer, but I cannot figure it out. After tears, I am hoping someone here can help. Here is my YML model: Identity: columns: id: type: integer(10) primary: true autoincrement: true username: type: string(255) Profile: columns: id: ...

Stopping Hibernate from trying to get a calculated field from the database

I have a property of a business object which is calculated. The calculation involves some of the logged in user's details, and so can't be represented as a simple SQL query. I'm having trouble representing the field in the Hibernate mapping XML file, because Hibernate continues to try and retrieve the field from the database, although ...

Get the last insert id with doctrine 2?

How can I get the last insert id with doctrine 2 ORM? I didn't find this in the documentation of doctrine, is this even possible? ...

Correct way to count associated objects using JPQL

What is the correct way to write this JPA query? I am just guessing as I cant work it out or find it in my JPA book. Query query=em.createQuery("select m from Meeting m where count(m.attendees) = 0"); return query.getResultList(); I am currently trying this with Hibernate and I get a mysql error! ERROR org.hibernate.util.JDBCExceptio...

Nhibernate - How to Design DomainObjects and Mappings with CompositeId

Hi, at first i'm really new to ORM, nhibernate and FHN. i look into this stuff for a few days now. i have an existing database with 4 tables: so i tried first to get the Auswahl and RefAuswahlFilter to work. here are my DomainObjects: pls let me know when i can do this better [Serializable] public class Auswahl { public Auswahl...

Spring and Hibernate: can't delete entry

Hi everyone, I stuck with entry deleting an entry from DB. I have Hibenrnate integrated with spring. RDMS is HyperSql and application server is Tomcat 6. For dependency management I use maven and for development I use Eclipse with maven plug-in. Hibernate is in version: 3.3.2.GA Spring is in version: 3.0.3.RELEASE HyperSql is in ver...

Hibernate = Column not found

I am running an aggregate function in java through hibernate and for some reason it is giving me this error: INFO Binary:182 - could not read column value from result set: l_date; Column 'l_date' not found. When I run the MySQL query the column names are l_date and logins and I can not figure out why it is not finding that. I have ...

hibernate validator

Hi, I'd like to use hibernate (orm) together with hibernate validator. Within the documentation we can find the following: Out of the box, Hibernate Annotations (as of Hibernate 3.5.x) will translate the constraints you have defined for your entities into mapping metadata. For example, if a property of your entity is annot...

hibernate circular foreign key

I have to test some code I have not myself written. It is an integration test: the application is running continuously on a server and my tests run against it. The tests are Selenium tests, they launch a browser, execute some JavaScript inside it to simulate user actions and checks if the database is correctly updated. I have to restore...

How to apply a default-restriction on Entity-Bean @OneToMany Relationships

Dear all, I have to e ntity model like Customer and Order. Each customer could have thousand orders, well, I make OneToMany and ManyToOne relationship between these to entities. But the thing I want is how to restrict this relationship's list to only top 10 orders. I mean if it is possible to apply 'WHERE' condition as an attribute on @...

Where should I put my NHibernate SchemaExport method?

Where should I put my NHibernate SchemaExport method and how should I call it when I decide to recreate the database? Should I leave this in my startup project (an asp.net mvc project)? Should I create a seperate console project just for exporting my schema? I think these questions all originate from the fact that I don't want schema...

Unidirectional Relationship in Entity-Bean (JPA)

How to make Unidirectional Relationship in EJB 3.0 Entity-Beans (JPA)? For example Customer know about Order but Order has not any method for Customer. using (@OneToMany or @OneToOne or @ManyToMany) Regards ...

Using Hibernate inside a Glassfish 3 web service

I've got a Java application that uses Hibernate for persistence. Now I'm trying to expose part of this app as a web service deployed to Glassfish 3.0.1. The code that implements the service is in a JAR file that is deployed along with the WAR file into Glassfish. The service code in the WAR has no problem accessing the classes that us...

How to find the version of JPA?

How to understand What JPA version I'm using in EJB? Is JPA built-in EJB? Regards ...

Hibernate Monitoring Solution

Hello, I would like to monitor hibernate action. I see on the internet the zentracker monitor solution that permit to monitor a lot of activity of hibernate. But It is compatible with the last version of hibernate 3.5.*? if it's not, do you have solution to monitor query execution time, sessionFactory opened, persitence object created...

ORM for non-destructive system?

I don't know if there is a specific name for this, but I am designing an application backed by a database in which rows need to be immutable (not sure if that term applies here, but it is the closest to describing what I need). That is, instead of changing the data stored in a row, a new row would be inserted with the same id but a diff...

JP QL - Filtering result in a One To Many relationship

I am stuck trying to construct a JPQL query and was hoping someone with more JPA experience than mine could help. Consider the following two entities: class Author{ String name @OneToMany(mappedBy="author") Set<Book> books } class Book{ String title Boolean inPrint @ManyToOne Author author } If I want to return a spec...

newbie- Hibernate transitive persistence is not working

I have 2 tables parent/child which I am trying to insert records in. ParentID is a surrogate key in child table. I have cascade="all" in parent table's hbm.xml file. When I try to save both through my junit test case, both parent and child records get saved but when same thing is done through application running in jboss, record in paren...

Hibernate recursive query

My desired query is to get a list of Course objects that belong to a Category. My objects are as follows: public class Course{ String name; List<Category> categories; } public class Category{ String name; Category parent; } Since the categories reference each other, they can have an infinite depth: A A.A ...

Magento - Trouble with setting up Model Read Adapter

I was following through on Alan Storm's tutorial on Magento's Model and ORM basics and I've run into a bit of a problem. When I get to the portion where I load from the Model for the first time I get this error "Fatal error: Call to a member function load() on a non-object...". I've reset everything already and tried again from scratch b...