orm

Automatic reserved word escaping for Hibernate tables and columns

I am trying to use one Hibernate mapping for several different databases: H2, Oracle, MySql. Each database has a different list of reserved words. I would like Hibernate to automatically escape the reserved words. I know I can: use backticks to force escaping (escape everything just to be safe) change all identifiers so they are ce...

Using ColdFusion frameworks

Can anyone expound on disadvantages, if there are any, to using a ColdFusion development framework? I'm developing an application traditionally, and I'm tempted to use a framework having seen how simple some things can be done. But does it not come with a performance tax? I'm new to ColdFusion and frameworks in general, and I'm trying to...

XML data bases and ORM

Hello, A few years ago I used the Hibernate ORM for mapping database data to the objects and manipulate it. Currently I have xml database and the next question, Is there orm for the xml databases or something like this? It is my mistake I did not put technology, I need ORM for .net. ...

hibernate bidirectional one-to-many inserts duplicates

Hello everyone. I'm having issues with a parent-child relationship here. When I persist from the collection side (child side) I get 2 new children instead of one. Here is are the hibernate mappings: <set name="children" inverse="true" cascade="all,delete-orphan" lazy="true" order-by="CHILD_ID desc"> <key...

Can I select null as a column value in HQL query?

I need a list with three columns. column 1st and 3rd having values while 2nd as null. Can I do it through HQL query? I need something like this: select id, null, name from MyClass Where MyClass as well as underlying table has only two properties/columns ie, "id" and "name" ...

problem referencing JPA

Hey guys, I have to use a jpa project on one of my projects, but I'm having this error once I create an entitymanager and call persistencecontect in my sessionbean: @Stateless public class Biblio implements BiblioLocal { @PersistenceContext(unitName="BiblioJPA") private EntityManager em; /** * Default constructor. */ ...

Mapping production database

I just completed mapping 100~ tables from our production Oracle database. Along the way I noticed that many relationships were not modelling. Mostly foreign keys. Should I modify my mappings to include the appropriate relationships? Or should I keep the mapping as is to reflect the database 100%? I'm more inclined the map the appropria...

Struts2 Hibernate (returning a list causing hibernate to fetch data from all relationships)

Hello, I am creating dependent drop downs using Struts2 jquery. The problem is that getLobList() method inside action class is causing hibernate to fetch all data for a lob. If I remove that getter method, those logs are not created. Why is this happening any way to fix it? JSP page <s:url id="remoteurl" action="getLists"/> <sj:select...

How to retrieve a Doctrine record with all relational records?

Hi, I was wondering if there is a way to get a record with all relational data, something like a 'Deep-Fetch' So if a model Child were related to another model Parent, can we fetch Child & then access Child->Parent->name thru a single query? Doctrine today fires a query whenever a relationship is accessed. Is this too costly? does it n...

Many-to-many relationship on the same entity without additional join table columns

I have an entity that has many-to-many association to itself. If I needed some additional properties (like asked here) the answer would be to use a new intermediate entity. But without them is it bad practice to use direct many-to-many association to the entity itself? ...

JPA createNamedQuery syntax

Hello, In Pro JPA 2 (Apress) book, I have seen examples like, EntityManager em; Long count = em.createNamedQuery(countQueryName, Long.class).getSingleResult(); But, the api , hopefully applied to JPA 2.0, shows the syntax as createNamedQuery(String name) Parameters: name - the name of a query defined in metadata with a single p...

How do I insert collection of objects using MyBatis 3.x?

Hi. I'm a beginner with MyBatis. I just want to know how to insert a collection of objects from an instance of a class. Say I have a class User related to a Note in one-to-many relationship. I just like to mention that I built my schema using JPA 2 annotations via Hibernate's hbm2ddl. I'll add the key JPA annotations I used in the sampl...

JPA 2.0 Criteria and grouping of Predicates

I encounter problem with Hibernate EntityManager 3.5.3-Final when it comes to composite predicates. Example (not actual code snippet, but the idea should be clear): CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); Predicate predicate1 = criteriaBuilder.conjunction(); Predicate predicate2 = criteriaBuilder.conjuncti...

django models filter() and extra()

Hi all, I have a problem with the extra() method of queryset. So, i retrieve my objects with : invoices = Invoice.objects.select_related().filter(quantity__gt=0,begin__gte=values['start_day'],end__lte=values['end_day']) So it works, I have my invoices. After i use another time filter() : invoices = invoices.filter(max__gte=duration...

Mono ORM that works with PostgreSQL?

I've been trying to find a decent ORM that works with both Mono and PosgreSQL. Does anyone know of such an ORM? ...

Performance of returning entire tables containing blog text as opposed to selecting specific columns

I think this is a pretty common scenario: I have a webpage that's returning links and excerpts to the 10 most recent blog entries. If I just queried the entire table, I could use my ORM mapped object, but I'd be downloading all the blog text. If I restricted the query to just the columns that I need, I'd be defining another class that'...

hibernate dao design question

Im looking to create a generic DAO to handle CRUD in my hibernate app. My entities have most associations as LAZY fetching. But I find in order to have hibernate be efficient as possible with the SELECTs I have to create multiple methods on my DAOs. Here's what I mean: Entity A has two associations. Sometimes I want to retrieve this...

In Hibernate, why Set is the recommended way to represent many-valued associations.

Taken from here: http://docs.jboss.org/hibernate/stable/core/reference/en/html/persistent-classes.html#persistent-classes-equalshashcode I tend to use List since Criteria returns List, so it makes my code cleaner since I don't have to do conversion. I do something like so.. @OneToMany(cascade= {CascadeType.PERSIST, CascadeType.REMOVE}...

Entity Manager / persistance file structure

hi all, The title isnt clear as i couldnt think of one but, i have an EJB project and am trying to play with JPA. To create the entity manager i am injecting it in via anotations @PersistenceContext(unitName="testConnection") private EntityManager em; when i run a test qurey which i belive to be fine Query userQuery = em.cr...

In Sqlalchemy, if i add an object using session.add() and flush it, session.query() does not give that object, why?

While using SQLAlchemy, i add a object to a session using session.add(objname), then either explicitly flush it using session.flush or enable autoflush=True while creating the engine itself. Now in the session, if want to return that object via session.query(classname).all(), i cannot retrieve it. Why is that so? or is there a way in w...