I have some code:
@Id
@SequenceGenerator(name = "SOMETHING_SEQ")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SOMETHING_SEQ")
@Column(name = "SOMETHING", nullable = false)
private Long id;
How is hibernate providing my id?
I see in my database there a single sequence named 'hibernate_sequence' and no other hibern...
Hi,
My native query below is working fine oracle sqlplus. But through JPA native query, giving following error:
[ERROR] org.hibernate.util.JDBCExceptionReporter - ORA-00923: FROM keyword not found where expected
Native Query
SELECT sch.school_name, term.term_name, count(material.MATERIAL_ID), sip.SIP_COUNT, ... FROM VA_SCHOOL sch ...
I have my ear-project deployed in jboss 5.1GA.
From webapp i don't have problem, the lookup of my ejb3 work fine!
es:
ShoppingCart sc= (ShoppingCart)
(new InitialContext()).lookup("idelivery-ear-1.0/ShoppingCartBean/remote");
also the iniection of my EntityManager work fine!
@PersistenceContext
private EntityManager manager;
Fr...
I'm new to JPA and I'm having problems with the autogeneration of primary key values.
I have the following entity:
package jpatest.entities;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class ...
I'm using JPA but I'm not sure how to use it for
relation between two classes. I need to connect them
@OneToMany. I have done this before but forgot.
Is there any good tutorial for this or an example that
is easy to understand.
By the way this is a Flex application where I'm using
BlazeDS for connection between Java and Flex.
...
private String message = "";
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
I am using EJB3 and MySQL 5.1 using Java.
I want to insert paragraphs of texts into MySQL Database using Entity Bean.
But, When I add, MySQL can accept only 255 characters. It shows m...
I'm teaching JEE, especially JPA, Spring and Spring MVC. As I have not so much experience in large projects, it is difficult to know what to present to students about optimisation of ORM.
At the present time, I present some classic optimisation tricks:
prepared statements (most of ORM implicitely use them by default)
first and second-...
I'm trying to use JPA with GWT.
My serviceImpl calls
UserDAO.exists(user);
When I run a test case, which calls the same method, with the same parameters, it runs ok. When I do the RPC call, if fails horribly (error at the end).
When I rename persistence.xml to someothername.xml, I get the SAME error, so I'm inclined to think that GW...
I am developing an EJB application to run on glassfish v3. If I look at the javadoc for the EntityManager class it says that methods like find, persist etc throw exceptions derived from PersistenceException. However, in practice I notice that exceptions derived from org.eclipse.persistence.exceptions.DatabaseException can be thrown if so...
I'm trying to get a new Enterprise Application Project set up in Eclipse using Glassfish as my app server and I'm seeing the following warning:
Classpath entry eclipse.fproj.jdt.libprov.osgi/jpt.jpa is marked for publish/export but is not exported on the project classpath. Classpath visibility within Eclipse and at runtime will differ.
...
I've created a very simple "Enterprise Application" project with about 7 entity beans and one stateless session bean. I've also configured an instance of Glassfish v3 to run as my application server. Unfortunately, when I attempt to publish the EAR to Glassfish, I'm getting the following response:
SEVERE: Exception while invoking class...
We have some JavaEE5 stateless EJB bean that passes the injected EntityManager to its helpers.
Is this safe? It has worked well until now, but I found out some Oracle document that states its implementation of EntityManager is thread-safe. Now I wonder whether the reason we did not have issues until now, was only because the implement...
A project I am working on uses Spring 2.5 & JPA with Hibernate as a provider.
My DAO classes extend JpaDaoSupport, so I get my JpaTemplate using the getJpaTemplate() method.
The back-end database can get changed either by my application, or a third-party application.
When a third-party application changes the database (mostly config...
can any body tell me how can i store Java Date to Mysql datetime...?
when i am trying to do so...only date is stored and time remain 00:00:00
in mysql date stores like this...
2009-09-22 00:00:00
i want not only date but also time...like
2009-09-22 08:08:11
please help me....
EDIT----
i am using JPA(Hibernate) with spring mydomain cl...
I am testing a Seam application using the needle test API. In my code I am using the getEntityManager() method from EntityHome. When I run the unit tests against an in memory database I get the following exception:
java.lang.IllegalStateException: No application context active
at org.jboss.seam.Component.forName(Component.java:1945)
at ...
Can anyone point me to an example of configuring JPA/JOTM in an environment where Spring isn't being used?
I'm building a web-app with Tomcat and JPA/MySQL. Currently I'm just using the RESOURCE_LOCAL transactions in the JPA persistence unit, but I'd like to move to a real transaction manager (JOTM) if possible. I've looked all over t...
Hey guys, my goal is create an EntityManager using properties dependent on which database is in use. I've seen something like this done in all my Google searches(I made the code more basic for the purpose of this question):
@PersistenceUnit
private EntityManagerFactory emf;
private EntityManager em;
private Properties props;
@PostCon...
I'm using Hibernate Validator 4.0.2, Spring 3.0 and Hibernate 3.3.2 (which, as I understand it, is pre-JPA2) as a JPA 1 provider.
I've found it easy to integrate the Validator into the MVC layer (it just works) but can't see how to integrate the validator automatically into the JPA entityManager (JPA 1).
Basically, I have some entities...
Hello,
I have entity model like this (using EclipseLink and JPA 2.0):
@Entity
class A {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
Long id;
//equals, hashCode autogenerated by nb.
}
And:
@Entity
class B {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)...
This is a Hibernate/JPA question.
I have a set of Schedule objects, each including several Steps of various StepTypes. Each StepType is unique within a schedule, so the steps are stored as a Map<StepType, Step>. The code is annotated as:
@Entity
public class Schedule implements Serializable {
@MapKey(name="type")
@OneToMany(c...