orm

Hibernate mysql innodb

Hi! I wanted to force hibernate to use innodb. So, i changed the "hibernate.dialect" in order to have innodb, but i can connect to mysql, but when i do some transactions i have the following error: org.springframework.transaction.TransactionSystemException: Could not commit JPA transaction; nested exception is javax.persistence.Rol...

Is there any difference in performance between these two instructions?

i have the following criteria specification and wanted to know if there is any difference in the performance or the memory usage of them. 1st way: criteria.add(Restrictions.eq("case.estadoOperativo", Caso.EstadoOperativo.COMPLETADO)) .add(Restrictions.eq("case.estadoAdministrativo", Caso.EstadoAdministrativo.TARIFICADO)); 2nd ...

Persisting application settings with Hibernate

What is the best/prettiest/most flexible way of storing application settings with Hibernate? Is a single row table the way to go, or is there a better way? The ability to store extra settings in the same place/table, but outside of the application domain would be nice. I've experimented with a Key/Value table, for example: Key | ...

Associating two resources, that are already related

I have three classes that need to be related, and I'm not sure how to do it. The User class, is of course for a user, Game represents a game, GameTurn represents a turn in the game. Game belongs to a user, the user who initiated the game, and GameTurn belongs to a user, the user who played that turn. What I want to do is associate User...

Hibernate - Return collection of entities by ID knowing only the class

How do I load a collection of entities of a given class, with only a single trip to the database, e.g.: public Collection<Object> getEntities(Class<?> entityClass,Collection<Serializable> listOfIDs); I know that if I were only wanting to fetch a single entity, I could use: sessionFactory.getCurrentSession().get(Class,Serializable); ...

JPA mapped model returns null elements with Composite-Keys

I have build my data model using JPA and am using Hibernate's EntityManager 3 to access the data. I used HSQLDB for testing (junit). I am using this configuration for other classes and have had no problems. However, the latest batch of tables use a composite-key as the primary-key and I am not able to retrieve the populated row from...

SQL syntax error with Derby and Circumflex ORM

I'm trying to use Circumflex ORM (as suggested on StackOverflow - here, here and here) to connect to a local (embedded) Apache Derby database over JDBC from a Scala project (built with simple build tool). I've followed the instructions carefully, but am having some interesting problems. Here's the driver and URL components of the cx.pro...

JPA EntityManager createQuery() with IN not working

About to kill myself here. This is failing: List<String> names = new ArrayList<String>(); names.add("sold"); Query query = em.createQuery("FROM PropField propField WHERE propField.name IN (?)"); query.setParameter(1, names); List<PropField> fields = query.getResultList(); And so is this: List<String> names = new ArrayList<String>();...

Customer-customizable ORM in .NET

I have a need for allowing business rules to be defined in a commercial, shipping product with respect to data authorization rules. The rules need to be customizable in the field, and the customizations need to survive updates of the application. The system is C#/ASP.NET. I've considered using a DSL for this, but it seemed like a lot ...

Difference Between One-to-Many/Many-to-One and Many-to-Many?

Ok so this is probably a trivial question but I'm having trouble visualizing and understanding the differences and when to use each. I'm also a little unclear as to how concepts like unidirectional and bidirectional mappings affect the one-to-many/many-to-many relationships. I'm using Hibernate right now so any explanation that's ORM rel...

Any .Net ORM frameworks that can natively persist data to disk (no database)?

I'm working on a project that normally uses SQL Server 2005; however, there is an additional requirement that the system needs to be able to run without a database - using data from serialized objects saved to disk. Are there any .Net ORM frameworks can do this natively, or can fairly easily be modified to do this? ...

MN relationships in Doctrine

ZF has a very nice feature which is called findManyToManyRowset which returns you directly a collection of objects from a MN connection. The whole purpose of MN is to get the information from the other table, not from the connection table. We have this schema: - users - id - name - groups - id - name - user_has_groups - use...

Problems with escaping table and field names in Derby and Hsqldb

I'm having a problem with my ORMLite package ( http://ormlite.sourceforge.net/ ). When I generate the schema for a table, I thought it would be a good practice to escape all entity names. This would protect some Java class or field name from being a SQL reserved word: CREATE TABLE "footable" ("stuff" VARCHAR(255)) I'm now adding "ra...

A Flush() problem after Merging an Entity

My problem is that I have an object A which contains a list of B Objects @Entity class A { @OneToMany(cascade={CascadeType.MERGE}) List<B> list; } When I make a "merge" of an object A and then call "flush" inside a stateless EJB method em.merge(a); //a is of class A em.flush(); //doesn't flush "list" it actually doesn't wor...

Easy way to truncate all tables, clear first and second level hibernate cache?

I'm writing some integration tests for a Spring/Hibernate app I'm working on, and I would like to to test things with as close to real conditions as possible, which includes using Hibernate's second level cache and committing transactions. I was wondering if there was an efficient way to ask Hibernate to delete everything from the datab...

n-layered architecture - BLL, DAL and interfaces. What is best practice?

I have a question regarding n-layer architecture. I thought long and hard before asking this question as there's a lot of similar questions here already... however, after literally a day and a half looking at it and reading these other answers I'm still unsure. The variety of seemingly similar terminology and different approaches has me ...

how to define an autoincrement id column in doctrine?

I'm using symfony 1.4 with doctrine as my ORM, I need to do one of two thing to get it working, and I don't know how to do it. If anyone can help me please do :-P the id fields should not be bigint, just int or When I define my table as follows: Table: columns: id: type: integer autoincrement: true primary: true make th...

GORM inheritance issue

I'm blocked on this GORM inheritance problem I have and id appreciate some fresh eyes to have a look over this problem. (Im using Grails 1.3.2) I have a base abstract class... abstract class MaintenanceSchedule { static belongsTo = [ maintenanceTask:MaintenanceTask ] } and I want to extend it like so... class OneOffSchedule exte...

SQLAlchemy returns empty, though the generated SQL returns full

I have this code: db.query(sets, stores).select_from(orm.join(sets, stores,\ sets.store_scheme_id == stores.store_id)).filter(sets.id == id).one() And I have the SQL debugging level at DEBUG, so it prints out the generated SQL query before it returns. The generated SQL works fine in phpmyadmin. SQLAlchemy, however, DOESN'T work fine a...

Remote execution of commands using the Django ORM

Can I somehow work with remote databases (if they can do it) with the Django ORM? It is understood that the sitting has spelled out the local database. And periodically to make connection to various external databases and perform any sort of commands such as load dump. ...