jpa

Java Persistence API(JPA) - Overriding MappedSuperClass's attributes

Hi, I have the following questions I have the '@Id' annotated field as part of my '@MappedSuperClass' and I am letting all my entities extend the MappedSuperClass.Now,how do I override the super class 'id' if I have to define a composite primary key for my entity...ie.How do I ask my entity to use its composite primary key annotated as...

Hibernate: Create Mysql InnoDB tables instead of MyISAM

How can I get Hibernate (using JPA) to create MySQL InnoDB tables (instead of MyISAM)? I have found solutions that will work when using Hibernate to generate an SQL file to create the tables, but nothing that works "on the fly". ...

How do i create this many-to-one mapping using JPA?

Hi, I'd like to achieve the following schema: Table A: a_id (other columns) Table B: b_id (other columns) Table C: c_id (other columns) Table D: a_id_fk b_id_fk c_id_fk I would like to know how to create entity D. All the keys a_id_fk, b_id_fk and c_id_fk in Table D form a composite primary ...

JPA Reverse Engineering multiple Datasources

I am using Eclipse, and my application works with two different DBs. I am able to reverse engineer one DB or the other, but I do not see how to set things up so that I may reverse both DBs. I only see that I may select one datasource. Is it possible to do this and I just do not see how? ...

Should I use Spring or Guice for a Tomcat/Wicket/Hibernate project?

I'm building a new web application that uses Linux, Apache, Tomcat, Wicket, JPA/Hibernate, and MySQL. My primary need is Dependency Injection, which both Spring and Guice can do well. I think I need transaction support that would come with Spring and JTA but I'm not sure. The site will probably have about 20 pages and I'm not expect hug...

Java JPA OneToMany - "Many" relationship not refreshing

I'm running into a strange problem using the Toplink implementation of JPA. I'm writing a stand-alone application to manage loans. I define a LOAN class that has a OneToMany (bi-directional) relationship with a NOTICE class. I created a GUI to display all the notices for a particular loan. In another part of my program I can send out...

A question on @IdClass JPA Annotation

Hi, Heres a composite primary key for one of my entities. public class GroupMembershipPK implements Serializable{ private static final long serialVersionUID = 7816433876820743311L; private User user; private Group group; public GroupMembershipPK(){ } public boolean equals(Object o){ if(o==null){ re...

JPA: How do I synchronize the persistence context with the result of the bulk update or delete?

Hi all, There's a statement in the ejb-3_0-fr-spec-persistence.pdf which reads The persistence context is not synchronized with the result of the bulk update or delete So if I do a query.executeUpdate which deletes rows from a table. Those same rows still exist in another entities one to many collection. When I restart the applicatio...

Where do I look for the database script generated from JPA Entities?

Hi, I am having a few errors like the following when I deploy my JPA entities into JBoss. 18:34:53,462 ERROR [SchemaExport] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Group (id)' at line 1 18:34:53,684 ERROR [SchemaExport] Unsuccessful: alter t...

EJB 3 with JDBC

Is it possible to use EJB 3 with JDBC. I read somewhere, that it's allowed. However, I hear that EJB 3 implementation uses JTA, by default. What does that mean for JDBC? Is it only for the transaction support? That means JTA is used for transaction when using JDBC code? Meaning that even local transactions are implemented as global tran...

Toplink IN subquery

Hi all, I hava 2 objects associate by oneToMany relationship("One Model can have many events"). I'm trying to make a subquery in ejbql to find models for one event, like this: SELECT model FROM RegModelValue model WHERE :event IN (model.events) .... but toplink doent recognize model alias and tell me "Internal Exception: line 1:12...

Wizard-generated JPA DAO method doesn't return an iterable List

I must be really stupid, but I'm at my wits' end with a JPA issue, using MyEclipse 7.5. I am accessing a DB2 database (on an AS400) via JPA. I have reverse-engineered a simple table to provide a DAO with some precision "find" methods. So far so good. If I run a SELECT statement over the table thus, I get 4 rows: SELECT * FROM MyTable ...

which connection pool to use with JPA/Toplink implementation in J2EE ?

I have J2EE Application where I am using JPA/Toplink now I want to implement external or internal connection pool ... please help me to figure out how to implement connection pooling with JPA/TopLink ... ...

jpa version cascade

JSR 220: Enterprise JavaBeansTM,Version 3.0 section 3.4.2 paragraph 3 All non-relationship fields and properties and all relationships owned by the entity are included in version checks. My Question: What does "owned by the entity" mean? ...

Sequence / Identity support in python webframeworks

Currently I'm evaluating web frameworks with an ORM layer and I've stumbled upon an interesting issue. I used tables with an ID column in a JEE (EJB3/JPA) application with different databases. In SAPDB I could define a sequence and use the jpa sequence generator annotation to deal with it, the same way I did on an oracle database previou...

How to obtain CURDATE() / NOW() on a JPA named query?

I want to do a select from table where date = TODAY, on mysql that would be "where date > CURDATE()", how do I do this on a JPA named query? ...

What does Hibernate/Toplink offer above JPA?

As far as I know, JPA itself offers all the shiny features like ORM, JPQL, entity relations mapping and so on. But I don't really understand, why do people use Hibernate or Toplink on top of JPA. What does Hibernate offer that JPA itself doesn't have? ...

Why doesn't JPA offer a loadChildren() method for lazily loaded relations?

There are times when I want to define a relationship as being lazily loaded, since 90% of the time I don't want the child entities, yet also have the possibility of getting the whole hierarchy at once, under certain circumstances. I don't want to achieve this by using a named query, since the parent-child hierarchy is useful when I conve...

How do I tell JBehave META-INF to configure it for JPA using the Maven plugin?

I'm trying to get JBehave, JPA and Maven to play nicely together. I can run the test via eclipse and everything works just fine. I run it via maven, and JPA can't find the persistence.xml file. However a unit test I have finds the persistence.xml file just fine, but JBehave is not involved. Clearly I need to tell JBehave to look in src...

JPQL for Entities with No Items in ManyToMany Relationship

Simple JPA/JPQL question. I have an entity with a ManyToMany relationship: @Entity public class Employee { @ManyToMany @JoinTablename="employee_project" joinColumns={@JoinColumn(name="employee_id"} inverseJoinColumns={@JoinColumn(name="project_id"}) private List<Project> projects; What is the JPQL query to retu...