I have a Java web application leveraging JPA. The database instance is specified in the persistence.xml file using the jta-data-source tag.
I would like to deploy a second copy of the web application on the same (glassfish) server, but pointed at a different database instance.
What is the best way to achieve this? I think ideally, I'...
When I use the unit of work pattern (with JPA), I get an entity from a repository, modify it and save the modifications at the and of the unit of work implicitly to the database.
Now I wonder how to perform validation with the unit of work pattern. If I apply changes (from user input) to a domain object and validate after that, the val...
I may be over thinking this one, but I am stuck...
I have an owned one-to-many relationship using AppEngine and JPA. My owning entity, lets call it 'MyList', owns entities of type 'Event'. In other words, every 'MyList' has zero or more 'Event' objects associated with it. I have no problem adding 'Event' objects to a 'MyList', and I hav...
I was trying to use the SessionCustomizer for auditing with v$session.program for oracle and it works with JDBC but i need it working with JPA, so i read a bit more the documentation for SESSION_CUSTOMIZER in this site: http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#EclipseLink_JPA_Persistence_Unit_Properties_for_Customi...
I have a mapping like this:
@ManyToMany(cascade = CascadeType.PERSIST)
@JoinTable(
name="product_product_catalog",
joinColumns={@JoinColumn(name="product_catalog", referencedColumnName="product_catalog")},
inverseJoinColumns={@JoinColumn(name="product", referencedColumnName="product")})
public...
Can I create an EntityManager from EntityManagerFactory outside a bean. If so, how would I do it?
...
The Eclipselink documentation says that I need the following entries in my pom.xml to get it with Maven:
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
...
</dependency>
<dependencies>
...
<reposi...
Below is my test code:
package jee.jpa2;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.persistence.Query;
import org.testng.annotations.BeforeClass;
import org.testng.annotatio...
We have the following classes
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE) // optional annotation as this is default
@DiscriminatorColumn(name = "apType", discriminatorType = DiscriminatorType.STRING, length = 255)
@DiscriminatorValue("AP")
public class ApplicationProcess {
}
And this
@Entity
@DiscriminatorValue("AP...
Hi guys
I have a designed a back end solution with Java Hibernate and JPA.
Now I want to implement it with Flex front end.
How shall I do it?
Is it possible without using BladeDS? Just using Servlet or something?
Please guide
Thanks
...
I have a JPA application that has specified JTA transactions in persistence.xml. For whatever reason, I have found that when using JTA, you MUST specify a JNDI data source within persistence.xml as well. This is fine, unless you are trying to go integration testing outside a container and JNDI is not available.
My questions are:
a) i...
Have anyone successfully run any spring and JPA application in jetty 7? I am getting following exception. This application throws no error in jetty 6.
INFO [main] org.eclipse.jetty.util.log - Logging to org.slf4j.impl.Log4jLoggerAdapter(org.eclipse.jetty.util.log) via org.eclipse.jetty.util.log.Slf4jLog
INFO [main] org.eclipse.jetty.uti...
I am using netbean 6.8 btw.
Let say that I have 4 different tables: Company, Facility, Project, and Document. So the relationship is this. A company can have multiple facilities. A facility can have multiple projects, and a project can have multiple documents.
Company:
+companyNum: PK
+facilityNum: FK
Facility:
+facilityNum: PK
+pro...
Hi,
I found this article which talks about using Spring as a JPA container:
http://java.sys-con.com/node/366275
I have never used Spring before this and am trying to make this work and hope someone can help me.
In the article it states that you need to annotate a Spring bean with @Transactional and methods/fields with @PersistenceCon...
when i insert persian information with use JEE6(JSF and JPA) my information save question mark for example "علی" ===> "???" my database is Mysql and my table is UTF-8 .
when insert persian data directly in database is correct and save correct.
i know that with change one property in JEE my problem go to solved
but i don`t know where ...
Does executing EntityManagerFactory.createEntityManager() reutrn new instance each time? or it returns the cached copy of the same EntityManager each time?
...
I have the following model
@Entity
class Element {
@Id
int id;
@Version
int version;
@ManyToOne
Type type;
}
@Entity
class Type {
@Id
int id;
@Version
int version;
@OneToMany(mappedBy="type")
Collection<Element> elements;
@Basic(optional=false)
boolean disabled;
}
and would...
I have the following entity class (ID inherited from PersistentObjectSupport class):
@Entity
public class AmbulanceDeactivation extends PersistentObjectSupport implements Serializable {
private static final long serialVersionUID = 1L;
@Temporal(TemporalType.DATE) @NotNull
private Date beginDate;
@Temporal(TemporalType....
I have an entity bean that will represent an expected result over multiple databases/datasources and can also be different queries executed, but same result always comming back. So the bean is re-used over different datasources that should be able to be dynamicly selected.
Is it possible with JPA to select during runtime the data source...
I am using EclipseLink and i have to audit in oracle so I can audit using pure JDBC with the V$session and i can audit the application name in oracle in this way but here in EclipseLink JPA I cannot set the application name to be audited, the way in which I have been trying is by setting dynamically the session param I want using the Ses...