Hi all
I'm using a oracle thin driver to connect to my database.My database links to another db(DB2) with drda specification.My problem is that I can only view the local tables of my database and map them using jpa but I select from drda in sqldeveloper and it works so the problem is definitely with my application development.What do yo...
I have an Employee entity class with (Id,Name,EmployeeType). EmployeeType entity (Id, Description) where Description can be either REGULAR/MANAGER.
I am confused on how to map Employees who are of type REGULAR to their corresponding MANAGER type Employees. Should I just add an extra field to the Employee entity itself so that it now be...
Hi, I have an Entity that looks like this:
public class NpcTradeGood implements Serializable, Negotiabble {
private static final long serialVersionUID = 1L;
@EmbeddedId
protected NpcTradeGoodPK npcTradeGoodPK;
@JoinColumn(name = "npc_id", referencedColumnName = "id", nullable = false, insertable = false, updatable = fals...
I have a PurchaseEntity that has a Set inside.
After doing entityManager.persist(purchaseEntity), purchaseEntity itself and purchaseItemEntity's are all saved to DB correctly.
But after that entityManager.persist(purchaseEntity) call, purchaseEntity.getItems() returns null.
Is this a normal behaviour of Hibernate provided entityManager...
I'm confused about class visibility in OSGi. I'm running Apache Felix and loading the following bundles:
the antlr, asm, jpa and core bundles from eclipselink
an OSGi-fied jar for javax.persistence 1.99
an OSGi-fied jar with the com.mysql.jdbc driver
a bundle of my own that contains annotated entity classes and a persistence.xml
anothe...
I am trying to get JPA (Toplink) configured to run in Jetty being run from the maven plugin and am getting a javax.naming.NameNotFoundException. The specifics.
web.xml:
<persistence-unit-ref>
<persistence-unit-ref-name>persistence/mod</persistence-unit-ref-name>
<persistence-unit-name>ModPU</persistence-unit-name>
</persistence...
I have a requirement to create a component which can be used stand-alone or within a larger application. When used stand-alone, it should not require a database, nor any database/ORM related dependencies. When used as as part of a larger app, some of the classes will indeed be persisted to a database via JPA/Hibernate.
I was thinking ...
Hi!
I have two entities like the following:
@Entity
public class Trip {
@OneToMany(mappedBy = "trip", fetch = FetchType.LAZY)
private Set<Job> jobs = new HashSet<Job>();
}
@Entity
public class Job {
@ManyToOne(fetch = FetchType.LAZY)
private Trip trip;
}
The problem is that the mappedBy relationship behaves diffe...
public class LoginTest {
public static void main(String[] args) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("IRCBotPU");
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
Login lg = new Login();
lg.setPassword("password");
lg.setUserName("Rocky");
em.persist...
in JPA, to use hibernate, the only thing need to do is moodify persitence.xml and add in hibernate configuration. May i know with JDO, can just by modifying jdoconfig.xml, able to integrate with hibernate? any reference or example on this?
...
I'm essentially looking for a "@Ignore" type annotation with which I can stop a particular field from being persisted. How can this be achieved?
...
I have a JPA entity class with a composite primary key (uid,lid) that in the database should look like this;
UID | LID | ...
---------------
1 | 1 | ...
1 | 2 | ...
1 | 3 | ...
2 | 1 | ...
2 | 2 | ...
2 | 3 | ...
How can I make EclipseLink/JPA generate sequence numbers on the fly, or how can I find out the high...
I'm running Spring and Hibernate's implementation of JPA on Sun's GlassFish Enterprise Server with MySQL.
When I try to delete stuff from the database:
Query q = entityManager.createQuery("DELETE FROM SomeEntity e");
q.executeUpdate();
I get the error:
Caused by: java.sql.SQLException: Error in allocating a connection. Cause: java.l...
I have been building a JSF application using JPA to access the DB. There are a number of entities.
I want to create a search results screen that shows columns from more than one entity in a table. These entities do not have foreign key relationships.
To achieve this I have used a EnttityManager.createNativeQuery and specified an Entity...
I'm writing a library that will be used to Hibernate many types of EJBs via JPA. When loading an EJB from JPA, the library needs the datatype of the field(s) annotated with @Id. The @Id may be annotated on a superclass of the EJB. Is there a method in Hibernate or JPA that can get the datatype of @Id?
I'm tempted to use reflection, b...
Hi. This (should) be a rather simple thing to do, however I am struggling.
I want a table to be generated like this:
id
organizationNumber
name
However, when I look in the database, I see that the ordering is wrong. Does anybody know how I can force hibernate/jpa to generate the table with correct ordering?
desc Organization;
+...
I'm having a bit of trouble with one particular issue using JPA/Spring:
How can I dynamically assign a schema to an entity?
We have TABLE1 that belongs to schema AD and TABLE2 that is under BD.
@Entity
@Table(name = "TABLE1", schema="S1D")
...
@Entity
@Table(name = "TABLE2", schema="S2D")
...
The schemas may not be hardcoded in an ...
Hi
I have the following use case: There's a class called Template and with that class I can create instances of the ActualObject class (ActualObject copies its inital data from the Template). The Template class has a list of Product:s.
Now here comes the tricky part, the user should be able to delete Products from the database but thes...
I'm using Xstream to serialize a EJB entity class to be transferred by a web service, but it also writes the database specific information in this case the following code. Is it possible to omit this information?
<oracle.toplink.essentials.internal.helper.DatabaseField>
<scale>0</scale>
...
I have data model classes that contain private fields which are meant to be read-only (via a getter function). These fields are set by my JPA persistence provider (eclipselink) during normal operation, using the contents of the database. For unit tests, I want to set them to fake values from a mockup of the persistence layer. How can I d...