orm

hibernate.properties classpath conflict

I have a jar on the classpath which contains a hibernate.properties. This causes problems when my app starts because hibernate tries to use the settings from this file. Is there a way to explicitly specify the file that hibernate should look for, or tell it to ignore the properties file in the dependency jar? ...

Converting to declarative method and column_property

Following suggestions, I am converting my project to declarative sqlalchemy class definitions. This allows me to define relations as strings ( a=relation('myotherclass'), instead of relation(myotherclass) ), and avoid cross importing issues. My question is how do I define column_properties the same way. This is sort of what I have (no...

How do I left join tables in unidirectional many-to-one in Hibernate?

I'm piggy-backing off of http://stackoverflow.com/questions/2368195/how-to-join-tables-in-unidirectional-many-to-one-condition. If you have two classes: class A { @Id public Long id; } class B { @Id public Long id; @ManyToOne @JoinColumn(name = "parent_id", referencedColumnName = "id") public A parent; } ...

How is my id being generated with JPA using Hibernate with the Oracle 10g dialect?

I have some code: @Id @SequenceGenerator(name = "SOMETHING_SEQ") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SOMETHING_SEQ") @Column(name = "SOMETHING", nullable = false) private Long id; How is hibernate providing my id? I see in my database there a single sequence named 'hibernate_sequence' and no other hibern...

Hibernate tool to create basic mappings based on a mysql db

Are there any tools that can look at a database, and generate the basic mapping files? It would be great if it could take a database, and create the actual model (java classes) with annotations, but not sure if that exists? ...

Sqlalchemy - Can we use date comparison in relation definition ?

Hi, I have this mapper defined: mapper(Resource, resource_table, properties = {'type' : relation(ResourceType,lazy = False), 'groups' : relation(Group, secondary = model.tables['resource_group'], backref = 'resources'), 'parent' : relation(Relation, uselist=False, primaryjoin = and_(relation_table.c.res_id == resourc...

Hibernate bug using Oracle?

Hello, I've got the problem, that I use a property in the persistence.xml which forces Hibernate to look only for tables in the given schema. <property name="hibernate.default_schema" value="FOO"/> Because we are using now 4 different schemas the actual solution is to generate 4 war files with a modified persistence.xml. That not v...

Django ORM without HTTP and commit_on_success decorator

Hello I'm trying to use Django's ORM in my non-HTTP part of project. In one function I need to make bulk inserts of data, so commit_on_success decorator is what I need. But I've found that this decorator doesn't do what supposed (didn't rollback transaction on error). I've go into this decorator with debugger, I've fount thar reason...

How to connect an ORM to the IoC container?

Hello, been searching a lot information about IoC/DI development, but I haven't found much information how to integrate an ORM into the IoC/DI development. Should the IoC know about the ORM? Or vice versa? How does the IoC configuration mapping work when mapping a "ORM type"? Example: public class Person : IPerson { private IPer...

Advantage Database ORM Tool or Code Generator Tool

Does anyone know if there are any ORM tools or Code Generation tools that work against an Advantage Database? ...

Starting on ORMS - Nhibernate

I am starting to delve into the realm of ORMs, particularly NHibernate in developing .NET data-aware applications. I must say that the learning curve is pretty steep and that a lot of things should be noted. Apparently, it actually changes the way you do data-aware applications, manner of coding, development and just about everything. ...

Testing DAO built with Criteria API using Jmock

I'm trying to unit test my DAO which uses the Criteria API. The Criteria object I have has a number of expressions and returns a unique result. The problem I have is that when I use Jmock to create an expectation I have to create one for the criteria.uniqueResult() command and I have to set a return type. The return type is a custom ty...

Is an ORM applicable for a non-CRUD database?

I'm pretty new to database development in general and I've never used ORM before. I'm interested in the benefits of using one, specifically saving time writing boilerplate SQL queries. I'd like to use ORM for a project that I'm working on right now, but I'm not sure it's applicable. This project is more akin to change tracking for very ...

JPA and hibernate for Flex

I'm using JPA but I'm not sure how to use it for relation between two classes. I need to connect them @OneToMany. I have done this before but forgot. Is there any good tutorial for this or an example that is easy to understand. By the way this is a Flex application where I'm using BlazeDS for connection between Java and Flex. ...

Optimizations employed by ORM's

I'm teaching JEE, especially JPA, Spring and Spring MVC. As I have not so much experience in large projects, it is difficult to know what to present to students about optimisation of ORM. At the present time, I present some classic optimisation tricks: prepared statements (most of ORM implicitely use them by default) first and second-...

Aggregating across columns in Django

I'm trying to figure out if there's a way to do a somewhat-complex aggregation in Django using its ORM, or if I'm going to have to use extra() to stick in some raw SQL. Here are my object models (stripped to show just the essentials): class Submission(Models.model) favorite_of = models.ManyToManyField(User, related_name="favorite_sub...

using Hibernate to loading 20K products, modifying the entity and updating to db

I am using hibernate to update 20K products in my database. As of now I am pulling in the 20K products, looping through them and modifying some properties and then updating the database. so: load products foreach products session begintransaction productDao.MakePersistant(p); session commit(); As of now things are pretty s...

Having an issue with org.hibernate.SessionException: Session is closed! in Hibernate

I've done quite a bit a research on this with no luck, but all the answers have a tendency to point toward the session context settings in the config file. What is odd is that I get a session connection the very first time I hit the page (and therefore, a successful result set), but then when I reload I get the following exception: org.h...

Effective Entity Update In Hibernate ?

How can I update an entity "effectively" in hibernate just as by using SQL. For example : I have a Product entity, which has a field name createTime. When I use session.saveOrUpdate(product) I have to get this field from database and then set to product then update, actually whenever I use session.saveOrUpdate(), I updated ALL fields, ...

SQLite on C# Cross-Platform Applications

Can someone help/guide me with using SQLite lib on Linux (MONO) and Windows (.NET) On linux i use native mono sqlite client, and on windows i use http://sqlite.phxsoftware.com/ is there a way to define 'using' directives like this : #if (linux) using Mono.Data.Sqlite; #else using System.Data.SQLite; Another problem is small diff...