orm

how to show complete sql string in kohana orm object?

this is probably trivial, but i have a quite long sql query and echo Kohana::debug( $obj ); cuts off the tail of the query, replacing it with '...'. how would i go about getting the full thing? (something nicer than var_dump if possible ;-)) ...

Error in my hibernate request

Hello i have this HQL request and i have an error when I run it My function: public ProprietaireInt getProprietaireInt(String codeImmeuble, String annee) { //Create connexion Session session = getHibernateTemplate().getSessionFactory().getCurrentSession(); ProprietaireInt proprietaireInt = new ProprietaireInt(); try{ ...

Integrating JPA2.0 and Spring

Hello last few hours I try to test with spring jpa 2.0 3.0 Finally I could recover objects persisted but when I try to persist a new object I receive the following error message: org.springframework.dao.InvalidDataAccessApiUsageException: no transaction is in progress; nested exception is javax.persistence.TransactionRequiredExceptio...

Is it bad practice to use DiscriminatorFormula for migration of Hibernate databases?

I have an application using Hibernate for data persistence, with Spring on top (for good measure). Until recently, there was one persistent class in the application, A: @Entity public class A { @Id @Column(unique = true, nullable = false, updatable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; ...

Long tag support in Tags

Tags field not displaying as expected when using long tags.. did anyone try that out ...

Hibernate Criteria API multiple joins

My hibernate entities are as follows: @Entity @Table(name = "EditLocks") public class EditLock extends AuditableEntity { /** The document that is checked out. */ @OneToOne @JoinColumn(name = "documentId", nullable = false) private Document document; Document then looks like this: public class Document extends Audit...

Changing auth.User._meta influences back-references during .filter()

I monkey-patched User model with the following two lines: User._meta.get_field_by_name('email')[0]._unique = True User._meta.get_field_by_name('email')[0].max_length = 125 -- and noticed, that models loaded after those two lines are executed, are not reachable from User.objects.filter(). For example, I have UserProfile model, ...

Implementing version-control functionality

Are there any recommended approaches for implementing version control functionality accessible to end users of a business application? The goal is to create a robust version control system for an application where users modify business objects (rather than text). I'm not looking for recommendations on version control software for devel...

hibernate "IllegalArgumentException occurred calling getter"

Here's my class hierarchy (lombok generated constructors/getters/setters ommitted for brevity): public class A { ... other variables ... @OneToMany(fetch=FetchType.LAZY, cascade = {CascadeType.ALL}) private Set<B> bSet = new HashSet<B>(); } public class B { ... other variables ... @CollectionOfElements @IndexC...

Hibernate Parent/Child SELECT N+1 issue

Hi Folks (and Pascal), I jave the following mapped superclass that provides a basic implementation for a parent/child self relationship to create a parent/child list for unlimited nesting of items (i.e. Categories) @MappedSuperclass public abstract class ParentChildPathEntity<N extends ParentChild> implements MaterializedPath<N> { ...

Telerik OpenAccess cross configuration file reference problem?

I have 2 libraries and one of them is a core library with some core persistent objects such as Person, Address, etc. I have another library which contains some different persistent objects that need to reference the core objects as well. When I try to map them using Telerik Forward Mapping, I get a complaint that I am referencing a "No...

HibernateTemplate findByExample returns no results

I'm trying to use Hibernate QBE (actually, Spring's HibernateTemplate.findByExample() ) to return a list of users by their username. I use a "known good" value to search on (the username "JOHN.SMITH" does exist in the database). Unfortunately, I get no results back. Below is the unit test. @Test public void testQueryByExample() { ...

Map str_name from another table using my cd_label in NHibernate

I want to map an entity from database, but I can't figure out how do this using NHibernate. My entity "Module" have just three properties: id, name and a list of "Entities". But my database table have the columns: id, cd_entity, cd_label. So this is my problem. How can I map the property cd_label (that need join another table TB_LABE...

Simply sqlalchemy filter not working

Select all works like this: q = session.query(products) Now I want to add a WHERE filter, so I am trying: q = session.query(products).filter_by(stock_count=0) I get an error saying 'nonetype' object has no attribute 'class_manager'. Not sure what the issue is? Update The column seems to be mapped fine, as when I do: q = session....

More than one relationship in two Hibernate Classes

Hibernate Gurus, I have a pesky issue and I don't really know how to solve my problem. I have a solution, however, I feel I may be reinventing the wheel. I have two entities, The first is a User Object, The second is an Alias Object. The relationship between the two is that A USER can have multiple ALIAS(es) and an ALIAS can be tied to...

Do I need Maven to use Hibernate?

I'm trying to use Hibernate for the first time, and early on in the getting started guide, it makes reference to Maven. If I'm not mistaken, Maven appears to be a build tool. However, I've been using Eclipse to build my project up to this point. Is there a way for me to use Hibernate without needing Maven? Can I just do what I need t...

Schema export with hibernate annotations

I'm using hibernate annotations and i want to export my database schema. Similar to the schemaexporttask with hbm xml files. ...

Keeping JPA EntityManager open?

I am learning JPA and the general pattern in examples seems to be as follows: EntityManager em = factory.createEntityManager(); em.getTransaction().begin(); // .... em.getTransaction().commit(); em.close(); Now I am wondering why do we continually create and close EntityManagers, as opposed to keeping it open and just starting new tra...

is it ok to mix session.save and various HQL updates that depend on that entity saving first

Hi, I've got a function with a session argument that does various HQL queries and HQL update statements in hibernate. They create sql that goes against alot of tables. All in one transaction. Now what I want to do is add one entity that this function depends on, in another function, with session.save, and then call the first function...

JPA: How to have one-to-many relation of the same Entity type.

There's an Entity Class "A". Class A might have children of the same type "A". Also "A" should hold it's parent if it is a child. Is this possible? If so how should I map the relations in the Entity class? ["A" has an id column.] ...