I have a JPA 2 Entity named Surgery. It has a member named transfusionUnits that is an Integer.
There are two entries in the database. Executing this JPQL statement:
Select s.transfusionUnits from Surgery s
produces the expected result:
2
3
The following statement produces the expected answer of 5:
Select sum(s.transfusionUnits...
Hello, and first off thanks for your time to look at this.
For a research project I'm working on, I have a somewhat complex design (which I've been given) to persist to a database via NHibernate.
Here's an example of the class hierarchy:
TransitStrategy, TransportationCompany and TransportationLocation are all abstract classes.
The...
i cant fully understand the ORM models in MVC.
so i am using symfony with doctrine. the doctrine models are created.
does this mean that i don't have to create any models? are the doctrine models the only models i need?
where should i put the code that uses the doctrine models:
eg.
$phoneIds = array();
$phone1 = new Phonenumber();
...
Hi all
My choice is between
Tapestry 5
Vaadin
JSF2
--- start EDIT 2010-05-13 18:04 --
Spring MVC (don't know why I forgot to mention this)
--- stop EDIT 2010-05-13 18:04 --
I like Vaadin most, because it seems to come with all the look-and-feel features out-of-the-box, I wonder if anyone has experience with Vaadin and JPA2, pre...
if i have 2 objectContexts for the same model each one hold some objects..
How can i find that object is attached to specific Object Context?
...
I'm well aware that similair topics have been brought up before
e.g. http://stackoverflow.com/questions/1639043/entity-framework-4-vs-nhibernate
But instead of arguments like:
NHibernate have been around longer and is more mature
EF4 is drag n drop and not enterprisy
EF4 and LinqToSql are ...
I would like to see a more detailed lis...
I use Hibernate3 and Hibernate Tools 3.2.4 to generate hbm.xml and java files and I want to use List instead of HashSet(...). I've tried to modify the hbm.xml files, putting list instead of set. Is there any way to specify to hibernate tools that I want to generate automatically a list not a HashSet?
This is an exemple:
Java class
publ...
How do you delete more than one entity at the same time in the designer Entities list. it seems that the designer interface only allows the selection of 1 entity at a time....
This is frustrating, is this possible? Or even deleting all entities?
Thanks
Regards
Luis
...
Create Table A (
ID varchar(8),
Primary Key(ID)
);
Create Table B (
ID varchar(8),
A_ID varchar(8),
Primary Key(ID),
Foreign Key(A_ID) References A(ID)
);
Given that I have created two tables using the SQL statements above, and I want to create Entity classes for them, for the class B, I have these member attributes:
@Id
@Column(name...
I'd like to have a combined query for two persistent classes.
In HQL this could be achieved by the select clause,
select new Family(mother, mate, offspr)
from DomesticCat as mother
join mother.mate as mate
left join mother.kittens as offspr
In the above example, Family is a conbined class with DemesticCat as its c...
How should I store an Java Enum in JavaDB?
Should I try to map the enums to SMALLINT and keep the values in source code only? The embedded database is only used by a single application. Or should I just store the values as DECIMAL? None of these solutions feels good/robust for me. Is there any better alternatives?
Here is my enum:
imp...
Looked at many forums but haven't found answer...Simple stuff, method annotated with @PostLoad newer gets invoked...added listener via @EntityListeners but problem remains. I'm using SessionFactory based configuration.
...
Assume the following exemplary DB-Design:
USERS
-----------------
ID
NAME
ROLES
-----------------
ID
NAME
USERS_ROLES
-----------------
FK_USER_ID
FK_ROLE_ID
LOGIN
PASSWD
I map this relation with eclipse-link using xml.
The users:
<many-to-many name="roles" mapped-by="users">
<join-table name="USERS_ROLES">
<join-column nam...
I often hear people bashing ORMs for being inflexible and a "leaky abstraction", but you really don't hear why they're problematic. When used properly, what exactly are the faults of ORMs? I'm asking this because I'm working on a PHP orm and I'd like for it to solve problems that a lot of other ORMs fail at, such as lazy loading and the ...
I'm trying the following:
MyResult.java :
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityResult;
import javax.persistence.SqlResultSetMapping;
@Entity
@SqlResultSetMapping(name = "myResults", entities = {@EntityResult(entityClass = MyResult.class)})
publi...
Hi can anyone tell me if its possible to write a cross tab query in JPQL?
(I'm using eclipse link JPA2)
An example of a cross tab query in SQL can found here http://onlamp.com/pub/a/onlamp/2003/12/04/crosstabs.html
SELECT
dept,
COUNT(CASE WHEN gender = 'm' THEN id ELSE NULL END) AS m,
COUNT(CASE WHEN gender = 'f' THEN id ...
What is the correct way to UPDATE a child object with NHibernate but not have to "awake" the parent object. Lets say you would like to try to avoid this because the parent object is large or expensive to initiate.
Lets assume classes are called Author(parent) and Book(child). (still, trying to avoid instantiating Author)
Book comes bac...
I am using Castle ActiveRecord as my ORM. When I try to store unicode strings, I get question marks instead.
Saving unicode strings worked perfectly when I was using mysql, but when I recently switch to SQL Server it broke. How should I go about fixing this?
...
Often three (or more) way associations are needed for habtm associations. For instance a permission model with roles.
A particular area of functionality has many users which can access many areas.
The permissions on the area are setup via roles (habtm)
The user/roles association is also habtm
The permissions (read, write, delete, etc...
We're running into an issue where we have Event subclasses that use GenerationType.TABLE to generate the primary key, and when we restart the servers we are getting duplicate primary key errors.
We're using SQL Server and Hibernate version 3.5.1-Final.
Here's what our Hibernate annotations look like:
@Entity
@Inheritance(strategy = In...