Given this query:
from s in services
select new
{
s.Id,
s.DateTime,
Class = s.Class.Name,
s.Location,
s.Price,
HeadCount = s.Reservations.Sum(r => r.PartySize), // problem here. r.PartySize is int
s.MaxSeats
}
If the service doesn't have any reservations, this exception is thrown:
System.InvalidOperatio...
HI,
I have query like this
final Query contractQuery = cgnDao.getEntityManager().
createNativeQuery("SELECT k.phrase, ak.type FROM key k INNER JOIN adkey ak USING (key_id) WHERE pck.pub_id =" + pid +" AND pck.c_id =" + campId );
How can i get each and every element from the query?
Where phrase is an String and type is...
One of the column is of the type XMLTYPE in Oracle database.
In my application, I want to persist the data and using Hibernate.
I did the following for mapping XMLTYPE in hibernate
Define the custom user type implementing UserType
The custom user type implementation is based on the blog link - http://community.jboss.org/wiki/MappingOr...
Given the following models:
class BaseMachine(models.Model)
fqdn = models.CharField(max_length=150)
cpus = models.IntegerField()
memory = models.IntegerField()
class Meta:
abstract = True
class PhysicalMachine(BaseMachine)
location = models.CharField(max_length=150)
class VirtualMachine(BaseMachine)
h...
What I have is an entity bean e.g. Entity (EJB 3) that keeps same type children in an ArrayList<Entity>, his parent <Entity> and a relation to another entity <Users>. Users can own many Entities, and vice-versa (many to many).
What I would like to do is override Entity.clone() (or have a new method) to deep-copy Entity along with clone...
Is there an ORM that will allow me to do the following?
db.Delete<MyEntity>(x => ***some predicate***);
We use NHibernate and I don't believe this is possible with it.
...
I've come across a couple of ORMs that recently announced they are planning to move their implementation from Active Record to Data Mapper. My knowledge of this subject is very limited. So a question for those who know better, is Data Mapper newer than Active Record? Was it around when the Active Record movement started? How do the two r...
A quote from persistence.xml:
<persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="true" />
<property name="hibern...
I want to translate the following HQL into Criteria notation:
from Deal
where CURRENT_DATE between startDate and endDate
I tried using Restrictions.between but it doesn't recognize current_date
Criteria c = session().createCriteria(Deal.class)
.add(Restrictions.between("CURRENT_DATE", "startDate", "endDate");
...
Hello.
I want a wizard where I insert the database connection, and with some settings it generates the PHP classes. The wizard can use (internally) a template already created.
Is that posible? Does that already exists? If not, any ideas of how to do it?
Thanks!
Edit
I'm looking for something wich let me make my own class template or...
Why I can't use EAGER fetching for the same purpose
...
I writing real estate web site
with basic function for choosing and ordering realty.
It is small/simple project, but I want to write it in way,
so in future I, or other developers, can turn it into medium business app without rewriting it
from scratch.
So what kind of patterns could you advice me to use for dealing with database?
For...
Hi,
I'm trying to use Hibernate 3.5.5 with Spring HibernateJpaVendorAdapter on Glassfish V2 but I'm getting the following exception when the Spring context is initialised:
java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getSharedCacheMode()Ljavax/persistence/SharedCacheMode;
at org.hibernate.ejb.util.LogHelper....
Hi,
I would like to know if we call a Java class annotated with hibernate classes. Can we get the data from the table in a XML format?
browser give data for id =1 --> Servlet --> hibernate class (with some magic xml functionality) --> returns the data in XML format(Can this really happen?)
Thanks,
Sana.
...
Hi,
I'm trying to learn JPA. I created a simple entity class. This entity has 3 columns: ID, NAME, NUMBER_A. It's working fine: I can persist, update and delete without problems.
What I'm trying to do is to create a calculated/computed column. I want to retrieve NUMBER_A, use it to calculate a new value and set the calculated column (l...
Zend has Zend_Db but it's not a full ORM. I already have sections of an app written in a way that uses Zend_Db. I do however want to integrate a full ORM into the application to use it for more complex database operations, but I don't want to have to re-write existing actions that are complete.
Those more experienced with Zend Framework...
Hi!
I try to build some application using hibernate for persistence (my first one). The application has genres and books. The genre class has a set of books. But every book in the set has the idGenre (the foreign key) value 0. I think the mapping is not right. Please tell me where is the mistake. Thanks.
Here is the mapping:
<hibernat...
This post is an continuation of this post
I have DlUser Class each object of this class may have DLFaceBook class and each object of DlFaceBook can have Friends which are mapped as myFriends.
I'm trying to map relation of the same class as many to many relation using bag mapping,composite primary key and static inner class. my code is...
I'm doing this in my model....
protected $_rules = array(
'id' => array(
'not_empty' => NULL,
'numeric' => array(TRUE)
)
....
Am I doing it right for the numeric qualifier?
Thanks.
...
I am getting this exception when I attempt to access an object that is stored in a property of my domain object. I have done some research and still do not understand why I am getting this error.
I have a very basic repository in which I am creating a session and then using a ICriteria query to fetch the first record from the list of r...