Hello,
I have a query that's basically "count all the items of type X, and return the items that exist more than once, along with their counts". Right now I have this:
Item.objects.annotate(type_count=models.Count("type")).filter(type_count__gt=1).order_by("-type_count")
but it returns nothing (the count is 1 for all items). What am I...
I'd like to integrate Propel with Zend framework. I've seen the integration of doctrine in the past but this post says it seems propel is done a bit differently.
Propel has two things going for it
already: the first is that Propel
includes its own autoloader, meaning
that I didn’t have to try and force
Propel into Zend Framew...
Hi,
I have an entity which has a collection as one of its attributes.
That collection is mapped with a @ManyToMany annotation with fetch type lazy.
The target entity also has collections as attributes, some are @OneToMany and some are @ManyToMany.
When fetching the first entity (via entityManager.find(id)) its collection attribute is ...
Hi!
Right now i want to make a small java application, in order to learn the hibernate framework. But it gives me the org.hibernate.MappingException: Repeated column in mapping for entity: model.Book column: author (should be mapped with insert="false" update="false"). And if I delete the author column mapping from entities.hbm.xml, the...
Hi,
I am writing a web based application with hibernate and jsp/servert. I have read about sessionFactory.getCurrentSession and sessionFactory.openSession methods. I know the basic difference between them [using getCurrentSession you dont have to close connection and when you commit the trasaction, your session automatically close]. Acc...
I was reading this book. Explaing about "@OneToOne unidirectional", the author has taken the following Customer, Address example:
@Entity
public class Customer{
@Id @GeneratedValue
private Long id;
private String name;
private Address address;
//few other columns, getters/setters
}
@Entity
public class Address{
@Id @G...
In NHibernate SessionFactory is said to be a heavy object and it is suggested that SessionFactory should be created once in application life span. However once we get handle to SessionFactory, we do call open() on it before doing any DB operation.
In EntityFramework we need to create an object of ObjectContext every time before doing an...
I'm using Single Table Inheritance in Doctrine2 to store OAuth credentials for multiple services. I'd like to use the service's id as the primary key; however, that's not unique across all services.
I've setup the database to use the discriminator column and the service's id as the primary key, but I can't find a way to make Doctrine u...
I followed all the instructions on this page : http://www.doctrine-project.org/projects/orm/1.2/docs/cookbook/code-igniter-and-doctrine/en
i did all things but the Command Line Interface doesn't work for me
when i execute the doctrine shell script in terminal it show me this
define('BASEPATH','.'); // mockup that this app was execute...
I have problem mapping the parent/child relationship in JPA and currently down with the follow error message -
java.lang.IllegalArgumentException: org.datanucleus.exceptions.NucleusException: App Engine ORM does not support multiple parent key provider fields.
at org.datanucleus.jpa.EntityManagerImpl.find(EntityManagerImpl.java:232)
...
How to get the most recently added row from a certain table, which satisfies a certain condition.
If I use javax/persistence/Query.html#getSingleResult() we get a NonUniqueResultException if there are multiple rows satisifying the query. I need the equivalent of findOne from the list. I would prefer not to paginate by setting the rowsPe...
I was wondering if there was such thing as 'belongs to' relationship, and what was its function, or if it was just the opposite to 'has one'?
The question arised when building an ORM, and wanted to find a way to determine when a entity instance should be automatically deleted, eg:
User 'has many' Thread
Thread 'has many' Comment
Thre...
At work, we design solutions for rather big entities in the financial services area, and we prefer to have our deployment mappings in XML, since it's easy to change without having to recompile.
We would like to do our development using annotations and generate from them the orm.xml mapping files. I found this proof of concept annotation...
This is my java class:
public class Finder {
@PersistenceContext(unitName = "abc")
EntityManager em;
public boolean exists(int i) {
return (this.em.find(Employee.class, i) != null);
}
}
This is the unit test:
public class FinderTest {
@Test public void testSimple() {
Finder f = new Finder();
assert(f.exists(1) =...
Is there any way to specify SQL comments through JPA annotations? Comments for tables and columns.
...
Hi,
I have two tables with a ManyToMany relation between them. Sometimes I need to refresh the
database so I delete elements from both tables. However relations
between deleted rows are still stored inside the automatically created
intermediary table.
To clarify the problem, here is a small code:
from elixir import *
metadata.bind =...
Hi all, I have a bare bones ORM implementation, consisting of data mappers which load and persist entities. Each mapper internally manages an identity map for all entities read from the database, so that the same entity is only loaded into memory once.
I am currently implementing lazy loading for related entities using a proxy class th...
I have a query but I dont know how to make it optimal. I have three objects.
SCP
Question : it has a field that points SCP (SCP_id)
Answer : it has a field that points Question (question_id)
How can I make a query that counts the number of answer within a given SCP
...
Hi
I’m trying to map some classes in hibernate there and have general problem how such mapping can be done.
There is User class and Facebook user class which has the following structure
User Class :
public class User{
public User(){}
Long Id;
String FirstName;
String LastName;
....
FbUser fbuser;
//// all requred
getters and ...
Hi I am using Entity Framework code only from CTP4. My question is this: given the name of a domain class which is mapped using an EntityConfiguration how can I retrieve the table name for the mapped class at runtime? I'm assuming I need to be using the MetadataWorkspace on the ObjectContext, but finding it difficult to get up-to-date ...