orm

Hibernate Cache and JdbcTemplate

Will the Hibernate caching(1st, 2nd, or Query) work when I use JdbcTemplate? I got to know that the caching is one of the advantage in using ORM instead of traditional JDBC. So, If I got to use Hibernate's JdbcTemplate, still can I enjoy the benefits of hibernate caching? ...

org.hibernate.hql.ast.QuerySyntaxException

i get this exception when i was running an application please give me a solution in my mapping file like as follows: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"&gt; <hibernate-mapping> <class name="mobilserv....

query with django orm

I need select rows with django orm. I need equivalent of such query select * from order where (user_from = u and f1 not is null) or (user_to = u and f2 not is null) I try to do this way: Order.objects.filter(user_from = self).exclude(f1 = None)+Order.objects.filter(user_to = self).exclude(f2 = None) But no union in orm.. how can be...

Replacing repository pattern with an ORM?

This is a repost of another thread i created. I think my first post was a little rhetorical in nature so it was closed so hopefully i can word my question better. There seems to be a push by some of the industry heavy weights to recommend using an ORM over the repository pattern and building your on DL Layer. So in your application lay...

Can an NHiberate entity have a natural-id in a component?

It seems impossible to me to have a natural-id in a component. public class User { private IAccount account; public User(string name, string password){ account = new Account() { UserName = name, Password = password }; } } public class Account : IAccount { public st...

Kohana ORM "primary value"

I've been reading through the documentation for Kohana ORM and in their example model class it has a block of code like: protected $_table_name = 'strange_tablename'; // default: accounts protected $_primary_key = 'strange_pkey'; // default: id protected $_primary_val = 'strange_name'; // default: name (column used as primary...

Entity Framework 4 Code First - Virtual properties not updating when changed to null

So I have a model in my domain similar to this: public class Product { public virtual Tag Methodology { get; set; } } Then in an webform project I update it like so: if (!string.IsNullOrWhiteSpace(ddlMethodology.SelectedValue)) product.Methodology = TagRepo.GetTagById(int.Parse(ddlMethodology.SelectedValue)); else product...

Doctrine 2 - problems with "Getting Started XML-Edition" - generating database schema

Having never touched Doctrine before (either 1 or 2), I am following this tutorial for Doctrine 2: http://www.doctrine-project.org/projects/orm/2.0/docs/cookbook/getting-started-xml-edition/en I'm at the point where I use the command line to generate the database schema. This is the cli-config.php file, as per the tutorial: <?php $cliC...

hibernate cascading delete, why not one delete on the foreign key ?

I'm wondering why hibernate generates 1 delete per entity on a child table instead of using one delete on the foreign key Here's the hibernate.cfg.xml (No i's not the next SO :-t <hibernate-configuration> <session-factory> <property name="hibernate.connection.url">jdbc:hsqldb:file:testdb;shutdown=true</property> <pr...

cannot resolve property when criteria refers to a embedded property.

I seem to be unable to create a query with a criterion which refers to a property inside a Embedded class. When i use "entity.embedded.property" it fails. If i create an alias of "entity.embedded.property" to itself the query works...Any tipes will be appreciated... ...

Can ORM skinned over bad database design reduce its effect to application?

I'm working in mid-size .NET application which has a very very bad if not worst database design, almost of tables don't do normalization and complex table design. E.g. I have one table to keep track of stock movement and every times I modify this table I need to update current stock table. In my opinion this is a bad design, because I c...

Is it possible to set aliases to a property within an Embedded as part of a Criteria ?

This is a general purpose question but from my experiences it does not appear to be possible to reference a property belonging to a embedded class within another. Directory Directory parent. Name // embedded String name; i cant seem to be able to create a Query that does find a directory where parent of parent's name is somet...

Object oriented representation of multi-table query

Hi all, Suppose we have two related tables, for example one representing a person: PERSON name age ... current_status_id and one representing a status update at a specific time for this person: STATUS_HISTORY recorded_on status_id blood_pressure length ... I have built an application in PHP using Zend Framework, and tried to r...

insert statement is not working in hibernate...

I'm using netbeans 6.9 and Hibernate and I'm trying to insert some values in a database (postgres) but I get the following exception: INFO: Not binding factory to JNDI, no JNDI name configured Exception in thread "main" org.hibernate.MappingException: Unknown entity: SELECTPACK.beanClass at org.hibernate.impl.SessionFactoryImp...

Tips for Manually Managing Persistence Context

I am investigating using JPA for my Data Access code. I am trying to write the business layer and data access layer so it will work in a web application and a Java SE application. Therefore I cannot use container managed persistence context. Most of my seraches on using JPA show examples in a container managed enviroment. At the mome...

Is it possible create column name with white spaces using hibernate?

Hi, I am building data base system for electronic components. Unfortunatly other programs, that will use some of my tables need to have white spaces in column names. Ive tried in my hbm.xml file something like this with property: ... property name="partGroup" column="part group" type="string" ... of course hibernate wont create table...

Hibernate: Query cache never used

Hi, During performing some performance tuning in my application I have noticed, that hibernate query cache is never used. I am quite sure I have it properly set up: hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider hibernate.cache.use_query_cache=true I use setCacheable(true) on queries I want to cache I have set u...

Hibernate and Inheritance (TABLE_PER_CLASS)

Hi, I use Hibernate to persist inherited objects but I got this message when I try to persist objects in database: org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; SQL [update Widget set CONTAINER_ID=? where WIDGET_ID=?]; nested exception is org.hibernate.exception.SQLGrammarExceptio...

JPA/toplink heterogeneous list of entities

Colleagues, Using JPA I need resolve following issue: at database level exits 3 entities (saying SuperEntity, DetailsAEntity and DetailsBEntity). SuperEntity contains common part of fields for DetailsAEntity and DetailsBEntity. So the question: is it possible to resolve collection of mixed elements DetailsAEntity and DetailsBEntity from...

JPA, Spring, Hibernate problem with loading entities ManyToMany Assotiation

I'm trying to get data from assotiation N:N, but I receive blank field. There are my Hibernate mapping class: @Entity @Table(name = "companies") public class Company extends NamedEntity { //some_code @ManyToMany( targetEntity = com.hqcargo.shippingstock.domain.CompanyProfile.class, cascade = {CascadeType.ALL, CascadeTy...