orm

How do you put raw-sql projections in an object using Hibernate?

Let's say I have a query that begins with the following projections: SELECT t.term as term, count(g.id) as amount This is raw sql, and I am using createSqlQuery on the Hibernate session object. What I'd like to do is take these projections and put them in an object that has a "term" and "amount" properties. With HQL, we can use "sel...

How can I go about translating Doctrines YAML models into json-schema

Basically I am looking to be able to reuse model definitions to target both Doctrine models and JSON-Schema. I don't care if it means defining it in a 3rd model language and having the ability to convert that to both yml and json-schema or if it is from json-schema -> yml as long as I have 1 place to update both of them. ...

web application structure hierarcy problem

Below an illustration of my project hierarchy When i try to connect my file_name.java file to hibernate i'm getting these errors Exception in thread "main" org.hibernate.HibernateException: Could not instantiate cache implementation at org.hibernate.cache.CacheFactory.createCache(CacheFactory.java:64) at org.hibernate.impl.Se...

PHP-Doctrine2: Items - Shops - ItemsAtShops - how to conveniently implement using Doctrine2?

Hello. Somehow I can't figure out how to implement the following relations using Doctrine 2 syntax: I have Items and Shops. Each item has different price and different quantity at each shop. So, I have Items table, Shops table and ItemsAtShops table. How do I reflect the last one in Doctrine? I guess I need to create ItemsAtShops enti...

HibernateTemplate Save Not Throwing Exception when trying to insert duplicate Key row.

Hello, I m using Spring's HibernateDAOSupport class to handle my DAO. my problem is that when I use getHibernateSupport().save(order) when order already exist in the database, it just update the database row instead of throwing some kind of Exception. my Hibernate hbm.xml file is : <hibernate-mapping> <class name="com.shopping.db.Cust...

understanding hibernate cache

If I have this method in object class: @OneToMany( fetch = FetchType.EAGER, cascade = { CascadeType.ALL }, mappedBy = "object" ) @org.hibernate.annotations.Cascade( {org.hibernate.annotations.CascadeType.SAVE_UPDATE}) @Column( nullable = false ) public Set<ObjectEntry> getObjectEntries() { return this.objectEntries; } ...

What to take care of when using NHibernate with WCF?

I am just a simple beginner with both NHibernate and WCF. I would like to use NHibernate as my ORM in the class library where my repositories are. I also need to use WCF to expose my business logic, and behind that my repositories, to the rest of the company. Is there some good documentation on how to accomplish this task? Are there pit...

What is a good lightweight ORM for our needs?

Ok I know "what X should I use" is very broad so let me narrow down our usage scenario. Basically, we should have been using an ORM a long time ago. Now though there is no way we can go through and rewrite every line of generated SQL Queries in our C# code. But we want to at least take a few steps in the right direction. So when we write...

LLblgen: Select distinct?

I can't seem to figure out how I can select only distinct entries in Llblgen 2.6 self-service model I essentially want this query. select distinct City from peopleTable where *predicates* I've got my PeopleCollection and I'm not sure if there's a distinct method I can call or argument I can pass to GetMulti(). ...

Please decipher the following error message: "Multiple keys in #<KeywordUser @user_id=1 @keyword_id=2>"

jruby google app engine error message: Multiple keys in #<KeywordUser @user_id=1 @keyword_id=2> Models: (attempting to implement has and belongs to many relationship) class Keyword include DataMapper::Resource property :id, Serial # required for DataMapper property :name, String # A varchar type string, for short strings ...

Bypass GeneratedValue in Hibernate (merge data not in db?)

My problem is the same as described in [1] or [2]. I need to manually set a by default auto-generated value (why? importing old data). As described in [1] using Hibernate's entity = em.merge(entity) will do the trick. Unfortunately for me it does not. I neither get an error nor any other warning. The entity is just not going to appear i...

When is it NOT advisible to use an ORM like Linq-to-SQL / Entity Framework for a program?

Possible Duplicate: Are there good reasons not to use an ORM? I've just started learning what an ORM is and how it can help me save time and make applications more secure. Since this is new to me, after using ugly SqlCommands and whatnot in my C# code, this is the best thing since sliced bread. However since I'm new I might n...

ORM/DAO/DataMapper/ActiveRecord/TableGateway differences?

Can you, please, explain me the differences between the following database representatives, say, in PHP.: ORM DAO DataMapper ActiveRecord TableGateway Any examples would be appreciated. ...

Wicket - which ORM?

Hi, I'm looking for an easy-to-use and intergrate ORM for Wicket application. I was thinking about Hibernate. Is it a good choice? What are the possible problems with Wicket/Hibernate? Any other suggestions are welcome. Thanks for any help. ...

Trouble with hibernate's named query

I am new to hibernate and I am having some trouble with the named query annotation. My code is as follows and is more or less generated by NetBeans The BasicUser class: package wmc.model; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Colu...

How to map Sets when using NHibernate Join Table per Subclass

I have the following HBMs (the sample is purely fictional, so don't try to understand the business needs) Class Document <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="Document" discriminator-value="Document"> <id name="Id" type="long"> <generator class="native" /> </id> <discriminator /> <p...

Hibernate query with partial key

I have two database tables, both mapped using Hibernate. The first table has a primary key with one field. The second has a composite primary key with three fields. Suppose I try to fetch results from the second table by providing just the partial key (one field), then I get an exception Exception in thread "main" org.springframework.o...

Is there a framework for data access in PHP?

I'm a .net developer by trade but I'm looking to expand to PHP. I really like what I've seen PHP can do. However I have been somewhat spoiled with data access in .net (such as LINQ) and how easy it is to make strongly type datasets. Are there such ways to do the same (or similar ) thinks for data access in PHP? A framework I'm unawar...

Strategic issue: Mixing relational and non-relational db?

There has been a lot of talk about contra-revolutionary NoSQL databases like Cassandra, CouchDB, Hypertable, MongoDB, Project Voldemort, BigTable, and so many more. As far as I am concerned, the strongest pros are scalability, performance and simplicity. I am seriously considering to suggest using some non-relational db for our next pr...

jpa merge not working

I have a problem with merging of objects using JPA. My code goes like this. EntityTransaction entr = em.getTransaction(); entr.begin(); Query q = em .createQuery("SELECT filterName FROM IbFilterName filterName where" + " filterName.filterId = 42352 "); List<IbFilterName> filterNameList = q.getResultList(); for(IbFilterName fil...