Hi guys,
I'm newbie to Java EE 6 and i'm trying to develop very simple JAX-RS application. RESTfull web service working fine. However when I ran my test application, I got the following. What have I done wrong? Or am i forget any configuration? Of course i'm create a JNDI and i'm using Netbeans 6.8 IDE. In finally, thank you for any adv...
I am facing an issue with Hibernate and JPA. My requirement is column CreatedDTTM and LastUPDATEDDTTM should be populated at the DB level. I have tried following but no use. My columns are set NOT NULL. I get a "cannot insert Null into LastUpdatedDttm" exception. Any guidance is appreciated.
@Column(name="LAST_UPDATED_DTTM", insertable=...
I have a JPA entity instance in the web UI layer of my application. I'd like to know at anytime if this entity has been already persisted in database or if it is only present in the user session.
It would be in the business layer, I would use entitymanager.contains(Entity) method, but in my UI layer I think I need an extra attribute ind...
I need LastUpdatedDttm to be updated by SYSDATE whenever record is updated. But below annoataions do nt work as desired. SYSDATE is inserted only once and not updated for subsequent updations. Also, lastUpdDTTM is not part of sql generated by hibernate.
@Generated(GenerationTime.ALWAYS)
@Column(name="LAST_UPDATED_DTTM",insertable=false,...
I'm using JPA 2.0/Hibernate validation to validate my models. I now have a situation where the combination of two fields has to be validated:
public class MyModel {
public Integer getValue1() {
//...
}
public String getValue2() {
//...
}
}
The model is invalid if both getValue1() and getValue2() are nul...
I'm currently working on a project that makes use of Seam/Hibernate (JPA) on MySQL. I'm reconsidering moving towards PostgreSQL after investigating some of the features that it provides. My question is, is there anything I need to worry about with this configuration? Limitations? Gotchas? Things to watch out for? There will be some...
I'm trying to create a JPA Entity backed by a view which does not have an id. The rows are uniquely defined by two columns, product id and node id. How can I specify that the id for the entity is a multi-column id, and do it using xml, not annotations?
...
Hi,
I try to deploy a project where EclipseLink JPA is used as ORM tool on an OSGI platform. The project works fine when running outside of a OSGI container.
Version used : Spring 2.5.6, EclipseLink 1.2.0
Unfortunately, I get this error on the OSGI platform :
Exception Description: Unable to acquire a connection from driver [null], u...
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...
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...
Hello...
I write an application based on an already existing database (postgreSQL) using JPA and Hibernate. There is a int2-column (activeYN) in a table, which is used as a boolean (0 => false (inactive), not 0 => true (active)). In the Java application i want to use this attribute as a boolean. So i defined the attribute like this:
@E...
Working with JPA / Hibernate in an OSIV Web environment is driving me mad ;)
Following scenario: I have an entity A that is loaded via JPA and has a collection of B entities. Those B entities have a required field.
When the user adds a new B to A by pressing a link in the webapp, that required field is not set (since there is no sensib...
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...
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 ...
I am trying to refresh the @ManyToMany relation but it gets cleared instead...
My Project class looks like this:
@Entity
public class Project {
...
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinTable(name = "PROJECT_USER",
joinColumns = @JoinColumn(name = "PROJECT_ID", referencedColumnName = "ID")...
Hi,
I am developing an application using Eclipselink and as part of the app I need to be able to manipulate some of the objects which involves changing data without it being persisted to the database (i merging/changing objects for some batch generation processes).
I am reluctant to change the data in the Entity objects, as there is a...
I'm planning on using CXF's rest implementation. I'm thinking of simply annotating my entity classes with jaxb annotations, such as @XmlRootElement, in order to create response objects. The benefit being avoidance of code duplication. As for the (client) request object, which will be used by a separate web app, I'm thinking of 'copying' ...
I have a generic class that is also a mapped super class that has a private field that holds a pointer to another object of the same type:
@MappedSuperclass
public abstract class MyClass<T extends MyIfc<T>>
implements MyIfc<T>
{
@OneToOne()
@JoinColumn(name = "previous", nullable = true)
private T previo...
Why does JPA require a no-arg constructor for domain objects ?
I am using eclipselink and just got this exception during deployment.
Exception [EclipseLink-63] (Eclipse Persistence Services-1.1.0.r3639-SNAPSHOT):
org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The instance creation method
[com.me.model...
I want to manage the database connection outside entity manager context so that I can use it for different entity managers. The question is how can I build the entity manager factory or entity manager with my own connection instead of providing it with properties in persistence.xml?
...