orm

Hibernate and Mysql timeout problem, doesn't work with c3p0

Hi, I have been having trouble with Hibernate and Mysql timeout error for a week. Apparently, After my Hibernate/MySQL have been running after 8 hours(which is default timeout value in Mysql), I have the exception. I also added c3p0. But it doesn't help. Please advice Thank you so much Here is my Hibernate Configuration: <property ...

When auto-mapping a collection with Fluent NHibernate, how do you make the child's foreign key to the parent nullable?

If I have a parent class: public class Parent { public Parent() { Children = new List<Child>(); } IList<Child> Children {get; private set;} } and a child class like so: public class Child { public SomeThirdClass Friend {get; set;} } Whenever I let the Fluent NHibernate's automapper hit these guys, it m...

Does Ruby on Rails' ActiveRecord support "disconnected recordsets" (like ADO.net)?

Using Microsoft's ADO.net, one can you query database -> disconnect database connection -> query/manipulate locally -> connect again (re-synchronize local with database). I've found value in this as overall it can minimize database hits. Does ActiveRecord support such a model/pattern? ...

Doing an "IN" query with Hibernate

I have a list of IDs in a String, and want to use Hibernate to get the rows with these IDs. TrackedItem is a Hibernate/JPA entity (sorry if I'm getting the naming mixed up here). My code is: String idsText = "380, 382, 386"; ArrayList<Long> ids = new ArrayList<Long>(); for (String i : idsText.split(",")) { ids.add(Long.getLong(i))...

ORM question - JPA

I'm reading Pro JPA 2. The book talks begins by talking about ORM in the first few pages. It talks about mapping a single Java class named Employee with the following instance variables - id,name,startDate, salary. It then goes on to the issue of how this class can be represented in a relational database and suggests the following sch...

django model -- relationships between inherited models?

I'm working on a server / datacenter inventory management tool. I have a class to define a default "device", which is then used to express custom devices (linux servers, windows servers, routers, switches, etc.) I also have data models set up to express IP addresses within a network. My question is, what would be the best way to expre...

Hibernate JPA - ManyToOne relationship not populated

I'm currently moving a (working) app from using EclipseLink to Hibernate JPA, mostly it's gone quite smoothly, but I'm finding one thing that I can't explain, and also can't think of any good search terms! Basically, I have four entities, with one-to-many relationships forming a chain: EntityA has a list of EntityB's, each of which has...

Doing table per subclass using a discriminator with NHibernate.Mapping.Attributes

I'm trying to do Table per subclass: using a discriminator using NHibernate.Mapping.Attributes. The hbm should look like this: <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <subclass name="SalesReport" discriminator-value="SalesReport" extends="Report"> <join table="SalesReport"> <key foreign-key="FK_SalesReport_Doc...

A couple of questions about the use of Hibernate and ORM with Oracle

I am thinking of writing a tool that will list all the tables in an oracle database. Clicking on any of the links for each of the table will load the data from that table. Usually i just use plain old jdbc with standard sql queries or stored procedures in the code. This has worked fine for me so far but i am wondering if using hibernat...

When should hasMany be used for N:1 relationships in grails domain classes?

In grails, I can implement an N:1 relationship like this: class Parent { hasMany = [children:Child] } class Child { belongsTo = [parent:Parent] } Now (if addTo and removeFrom is always properly used) I can get a Parent's children via parent.children. But I can also do it without hasMany: class Parent { } class Child { belongsTo = ...

Hibernate 2nd Level caching doesnt seem to be working

Im currently trying to get hibernate working using the caching provider that comes with hibernate. net.sf.ehcache.hibernate.SingletonEhCacheProvider I have a default cache and a class specific cache enabled in the ecache.xml which is referenced in my hibernate.cfg.xml file. The class/mapping file specific cache is defined to handle u...

Architecting from scratch in Python: what to use?

I'm lucky enough to have full control over the architecture of my company's app, and I've decided to scrap our prototype written in Ruby/Rails and start afresh in Python. This is for a few reasons: I want to learn Python, I prefer the syntax and I've basically said "F**k it, let's do it." So, baring in mind this is going to be a pretty ...

JPA/Hibernate Native Queries do not recognize Parameters

I am using Hibernate/JPA to execute native PostGIS queries. The problem with these queries is that they need parameters that are not of the classical X = 'value' form. For example, the following lines crash String queryString = "select * from Cell c where ST_DWithin(c.shape, SetSRID(ST_GeomFromEWKT('POINT(:lon :lat)'),4326), 0.1)"; ...

Is it illegitimate to name an JPA entity "Group"?

I'm developing a JEE6-application, using JPA 2.0 and Hibernate 3.5.2-Final as the Provider (and MySQL 5.1.41). My Application Server is Glassfish V3.0.1. I already have a working CRUD-app with some entities and relationships. Now i added an (really simple) entity with the name "Group". The entity class looks like this: package model //...

how to call stored procedure using spring and hibernate

I get an error message as java.lang.reflect.UndeclaredThrowableException and Invalid column name. Can you help me why am i getting this error. ...

How to choose that which ORM would be feasible for or Application? e.g if we are using Linq then why not hibernate

How to choose that which ORM would be feasible for a web Application? e.g if we are using Linq then why not nhibernate? and Which one is better and why ...

Removing parent and all children

Hi, I have a problem removing the parent entity from the database. The code looks like this: public class Parent implements Serializable { @Id @GeneratedValue(strategy = GenerationType.TABLE) private Long id; @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN) @OneToMany(cascade = CascadeType.ALL, fetch = FetchTy...

How can i mix OR and AND in ORM queries

I am developing a site using kohana 2.3 and am having trouble with a specific ORM query. Essentially what I am doing is the following query SELECT * FROM 'records' WHERE ('ServRepSupervisor' = name AND 'Followup_read' = 0) OR ('ServRepSupervisor' = name AND `read` = 0) when I try the ORM query like this... $unread = ORM::factor...

how can i get ORM to work with 2 separate databases without foriegn keys defined in the tables?

I'm not even sure if this is possible. I am using Kohana framework(ver 2.3). I have 2 separate databases. One called 'employees' and another called 'tracker'. The databases are used in 2 different websites. I want to eliminate a table in the tracker database called 'csr', which contains identical employee data, and link the tracker to th...

Filtering collections in Entity Framework 4

I have been testing out EF 4 and am looking to filter child collections on an object. I'm using POCO support and have EF wiring up my collections automatically: public virtual ICollection<Product> Products { get; set; } So in this example, I can get an instance of a category and then enumerate it's products. What I want to k...