Java AppEngine: JDO or JPA, How to choose??
Pros and Cons of choosing JDO or JPA for a Grails Application that will run on Google AppEngine ...
Pros and Cons of choosing JDO or JPA for a Grails Application that will run on Google AppEngine ...
What is the Hibernate best practice when having to roll back foreign key relationships, but not wanting to throw out the transaction (ie. still proceed with saving other data)? If I just pass the exception back up the stack or don't do this rollback, then I will hit an error when I do try to save the other data (Null or Transient Object...
I have two tables: Ta and Tb. They have exactly the same table structure but different table names. I try to create one entity class to map the table structures. Some of my common application modules will use this entity class to dynamically query and update either Ta or Tb based on parameters. Can it be done in JPA? How can I write ...
Imagine 2 tables in a relational database, e.g. Person and Billing. There is a (non-mandatory) OneToOne association defined between these entities, and they share the Person primary key (i.e. PERSON_ID is defined in both Person and Billing, and it is a foreign key in the latter). When doing a select on Person via a named query such as: ...
I'm trying to use an existing database with Grails. My DataSource.groovy starts with this: import org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsAnnotationConfiguration dataSource { configClass = GrailsAnnotationConfiguration.class pooled = true driverClassName = "com.mysql.jdbc.Driver" username = "root" password...
I am using Hibernate + JPA as my ORM solution. I am using HSQL for unit testing and PostgreSQL as the real database. I want to be able to use Postgres's native UUID type with Hibernate, and use the UUID in its String representation with HSQL for unit testing (since HSQL does not have a UUID type). I am using a persistence XML with dif...
I am using an EXTENDED Persistent Context because it will allow me to Lazily Load a one-many relationship on an object and it also won't require a SELECT before I "merge" an object with the persistent context. I have an DummyObject with: A "Last Updated" Date Field A One-Many Relationship This Object is being updated every 5 seconds...
We have an app that we are developing and we are considering supporting two different JPA implementations. At the moment we are using openjpa and have fairly well tested code. I swapped in toplink, ran the tests, and found a bunch of failures. You'd think that because JPA is a standard there shouldn't be any differences! The rational...
I have been trying to find a definitive resource for all of the hints that can be set through the Query.setHint(String,Object) method call in JPA, but I am coming up empty. Anyone know if a good reference? ...
Does anyone know of a tool that can do that? Linguine maps seems to only work on old hibernate xml files. And the hibernate tool task hbm2hbmxml seems to have a bug so that I can't do the two step process "annotations->hbmxml->diagram" Best, Anders ...
I'm working on a web project using EJB 3.0, and whenever EclipseLink tries to interact with the database, it says that the schema I'm using doesn't exist (which it does). I get a massive, unhelpful stack trace from GlassFish 2.1, which begins with: EclipseLink, version: Eclipse Persistence Services - 1.1.0.r3639-SNAPSHOT file:/C:/Docu...
I'm going nuts trying to get a simple Envers example to work. I'm stuck on the org.hibernate.tool.ant.EnversHibernateToolTask it looks like I finally got all the jar files I needed, but now I get the error message [hibernatetool] Persistence unit not found: 'ConsolePU'. BUILD FAILED C:\deka\proj\java\test-database\build.xml:61: Persi...
Hi! I don't like the requirement on have at least one empty constructor and public setters on JPA entities. While I understand the issue on the EntityManager side, this invalidates class invariants. Does anyone have a solution for this (design pattern or idiom level) ? Thanks! Igor ...
I'm using Hibernate's EntityManager as a JPA implementation. What I want is logging of the query (HQL or JPA Query Language) made to EntityManager. This is different than SQL logging (which is enabled with the hibernate.show_sql property). My application issues several queries to Hibernate. I want logging of both the queries issued to H...
Hi, I have a one way @OneToMany relationship between a Team and Player class. I would like to save a Team object among your Players. Player's identifier IS COMPOUND by Team foreign key and list index as follows. I have a mapping like this one because i need to save Team and your Players ate the same time. @Entity public class Team { ...
I have a class hierarchy: abstract DomainObject { ... @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="SEQ") @SequenceGenerator(name="SEQ",sequenceName="SEQ_DB_NAME") @Column(name = "id", updatable = false, nullable = false) private Long id; ... } BaseClass extends DomainObject { ... // Fill in ...
I'm not really sure how annotations actually work. I'm using JAXB and JPA (with eclipselink) on the same classes, i. e. I get class definitions like this: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Channel") @Entity public class Channel extends NamedEntity { @XmlAttribute @XmlSchemaType(name = "anyURI") @Column(n...
What is the right way do validate a jpa query programmatically. Hibernate validates all annotation based named queries on entities. But how can I call this validation routine on programmatically builded jpa queries, to check for errors? @Entity public class Foo { @Id public int id; public String name; } main(...) { Query q = ...
hi, i have a webapplication, using hibernate and the following entities. What do I wrong: ... @Entity public class Registration implements BaseEntity { ... @OneToMany(cascade = {CascadeType.PERSIST}, mappedBy = "registration", fetch = FetchType.EAGER) private List<OrderedProduct> orderedProducts = new ArrayList<OrderedProduct>(); ... pu...
Is there a way to change the JPA fetch type on a single method without editing the entity object? I have a shared ORM layer consisting of JPA entity classes. This ORM layer is accessed by two DAO layers. One DAO needs lazy fetching, as it is for my web application, the other needs eager fetching, as I need it to be threadsafe. Here is ...