What documentation (books or online resources) you would recommend for a JPA newbie, which want to program with the play framework?
In play you only use annotations and hibernate as JPA implementation, so it would be useful if there would be the focus on.
I started with wiki-book, but not sure if it is the best solution.
A book for gr...
If I have a class Apple that extends Fruit, how do I write a JPQL query to return all objects that are strictly Fruits and not Apples?
...
I am receiving the following Hibernate Exception:
@OneToOne or @ManyToOne on Matchup.awayTeam references an unknown entity: Team
The simplified Matchup class looks like this:
@Entity public class Matchup implements Serializable
{
protected Team awayTeam;
@ManyToOne
@JoinColumn(name="away_team_id")
public Team getAwayTea...
Hi,
I am working with JPA (1.0 or 2.) + hibernate (3.4.0 or 3.6.0) and I have run into a problem with I think caching somewhere. What I do:
Find an object with my JPA class (row in the database with a particular id)
update a boolean flag on the object (tinyint field in the database)
persist the object
grab the entire table from the ...
After calling list() on a Hibernate Query which you expect to just return a list of Foo objects (see example below), how best would you deal with this situation?
Query query = session.createQuery("from Foo");
List list = query.list();
I don't particularly like seeing this:
public List read() { ... }
When I would much prefer:
pub...
If I have an entity called Foo that looks a little like this:
@Entity
public final class Foo {
private int id;
private String name;
...
}
I want to retrieve the names of the Foo objects that have an id greater than 10. If I already have a collection of Foo objects, I could do something like this:
List<Foo> foos = ...
Que...
Hello
I have the following situation: a class Event that has a collection of Participant objects, but the class Participant don't have any reference to event. So, I need to get the first 5 most recent participants of a given event, just could not figure out how to this. I know that after get the query done I just need to limit the resu...
The dataset I display using PageableListView can get very big and keeping the whole dataset as a model would be very inefficient. Is it possible to load for example only the set of IDs first and then load only the objects that are to be displayed on the current page? I use Wicket+Spring+Hibernate/JPA. Or is there a better approach to pag...
In JPA is there an annotation to specify that boolean fields should be persisted as an integer.
I'm using OpenJPA and it's currently persisting boolean fields as bits. I'd rather use integer 1 or 0.
...
Possible Duplicate:
concurrency (stale data) problem in JPA
Sorry for duplicating, but I think I didn't get satisfactory answers so posting again
Let's say I have methods with following signature
Object getData(int id) {
//create a entity manager
//get data frm db
//return data
}
updateData() {
Object obj = getData...
Hello there,
I was learning some JPA to teach to some java friends and I was wondering, how do you handle updates that comes after the creation of the db in JPA? Let's say I have a production environment where there's data that I cannot lose.
Some changes comes in and how do I apply that on my production environment? It there a way th...
Ok I have a 1-to-many mapping between a parent and child class. I can save the parent and it will automatically save the children objects, but problem is when doing a SELECT on the parent class. It seems that I'm getting a Parent object for every Child object in database table.
So if I save 1 parent object with 2 child objects, when I u...
My domain model in my Java EE 6 application contains bi-directional relationships like the following:
@Entity
public class Users implements PrimaryKeyHolder<String>, Serializable {
@Id
private String username;
@ManyToMany(mappedBy= "users")
private List<Category> categories;
public List<Category> getCategories() {
if (c...
I would like to use Criteria API in my new project and from what I understood, I also need to do annotation processing. Since there Java 5 on the server, how is this possible using Java 5 and Maven?
...
Hi All,
I am facing a strange issue with JPA CascadeType.REFRESH attribute.
I have a simple parent-child relationship in which in parent domain object(LineEquipmentFormat) I have added the cascade attributes like below
OneToMany(cascade = { CascadeType.REFRESH, CascadeType.MERGE, CascadeType.PERSIST,
CascadeType.REMOVE}, mappedBy = ...
I've been trying to find a JPA Criteria API tutorial but haven't been much successful. Do you know about any for beginners? I'd like to start using it in an Java5/Maven app to build complex search queries.
...
Hi folks,
I have what I would assume is a pretty standard setup...spring, jpa (hibernate) and I'm trying to add ehcache.
I have it all configured and verified that it's working...I'm logging the hibernate sql statements and cache statements and can see that the cache is getting invoked and that once the object is in the cache, when I t...
I am trying to implement the following convenience method:
/**
* Counts the number of results of a search.
* @param criteria The criteria for the query.
* @return The number of results of the query.
*/
public <T> int findCountByCriteria(CriteriaQuery<?> criteria);
In Hibernate, this is done by
criteria.setProjection(Projections....
I have an JPA entity like this:
@Entity
@Table(name = "category")
public class Category implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false...
I am building an application under DDD architecture, thus I have implemented rich domain objects that can also be entities. These entities can also have full access to (injected) repositories that can do add & remove operations on other objects/entities. So far, this all works without any problems.
But can side effects for objects/entit...