Hi, is there a skeleton for a project using mysql, some eclipse/top link with RESOURCE_LOCAL as connection type? Preferably using maven. I'm searching for it for hours and can't get running even the sipmlest exaple. So if you had it ready and running, please, post :-). Even something as simple as these two classes only.
@Entity
public c...
I need to prevent simultaneous edits to a database field. Users are executing a push operation on a structured data field, so I want to sequence the operations, not simply ignore one edit and take the second.
Essentially I want to do
synchronized(key name)
{
push value onto the database field
}
and set up the synchronized item so ...
I am developing a Eclipse RCP plugin which uses JPA.
I tried to specify the database path via a variable give to the JVM on runtime.
The property is set correctly but the database is created in a folder named after the variable name (here: ${DBHOME}).
<property name="javax.persistence.jdbc.url" value="jdbc:derby:${DBHOME};create=true"/>...
When I try to do an entityManager.remove(instance) the underlying JPA provider issues a separate delete operation on each of the GroupUser entity. I feel this is not right from a performance perspective, since if a Group has 1000 users there will be 1001 calls issued to delete the entire group and itr groupuser entity.
Would it make mor...
Hi,
If I have a complex where clause which varies only slightly between many queries, in SQL I would create a view based on most of the where clause, then query the view multiple times.
Both for performance and maintainability.
I don't see an equivalent of that in jpql.
Am I or the jpql spec. missing something?
Cheers, Phil
...
I have a simple @OneToMany between Person and Pet entities:
@OneToMany(mappedBy="owner", cascade=CascadeType.ALL, fetch=FetchType.EAGER)
public Set<Pet> getPets() { return pets; }
I would like to load all Persons with associated Pets. So I came up with this (inside a test class):
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfig...
I am using the JPA(hibernate) for the ORM and c3po for connection pooling. While I am able to do all the CRUD operations it gives me the below error while accessing the the data:
Here are the tools:
Hibernate 3.2.1,
Oracle 10g,
ojdbc14,
connection pool: c3p0-0.9.
And the stack trace:
java.sql.SQLException: Unsupported feature
...
My Flex application uses a client-side pimento EntityManager which fetches quite a few objects and associations. It does this by forcing eager fetching of particular association ends in the form of fetch plans. I would like to update the client whenever a change has been made to an entity existing in the EntityManager's cache. Is it poss...
Environment:
JDK 1.6, JEE5
Hibernate Core 3.3.1.GA, Hibernate Annotations 3.4.0.GA
DB:Informix
Used reverse engineering to create my persistence entities from db schema [NB:This is a schema in work i cannot change]
Getting exception when selecting list of basic_auth_accounts org.hibernate.TypeMismatchException: Provided id of the wrong...
Hi All,
We have a system which performs a 'coarse search' by invoking an interface on another system which returns a set of Java objects. Once we have received the search results I need to be able to further filter the resulting Java objects based on certain criteria describing the state of the attributes (e.g. from the initial objects ...
Hi.
I have a set hibernate.hbm2ddl.auto to create so that Hibernate creates the tables in mysql for me.
However, it doesn't seem that hibernate correctly adds Cascade on the references in the table. It does however work when I for instance delete a row, and I have a delete cascade as hibernate annotation. So I guess that means that Hib...
Hello,
I try to delete a list of rows from a table using this Native Query:
@NamedNativeQuery(name="WebGroup.DeleteIn",
query="DELETE FROM WebGroup WHERE
WebGroup.GROUP_ID IN (:IDsList)"
getEm().createNamedQuery("WebGroup.DeleteIn")
.setParameter("IDsList", groupToDeleteIDs)
.executeUpdate();...
I have been reading about JPA and EJB3 and would like to confirm that my understanding of their relationship is correct. Here's what I think I know...
JPA is a specification that has been implemented by a number of vendors including:
JBoss/Hibernate
Oracle/TopLink Essentials (now EclipseLink)
Apache/OpenJPA
EJB3 is a specificat...
Has anyone figured out a smart way to do query result transformation through a similar mechanism like specifying a ResultTransformer in Hibernate?
All I can think of is transforming each result row after it has been returned by the Query. Is there any other way?
For constructor projections (e.g. new DTO(arg1, arg2)) it can be defined i...
Hibernate is flooding my IDE console with tons of unnecessary informations at every connection. I already read out the documentation and googled trying to solve this issue but till now the problem "persists".
My persistence.xml:
< persistence >
...
< property name="hibernate.show_sql" value="false" />
< property name="hibernate.use_sq...
This seems like a pretty simple question, but I have not managed to find a definitive answer yet. I have a DAO class, which is naturally querying the database by using criteria queries. So I would like to know if it is safe to use the same CriteriaBuilder implementation for the creation of different queries or do I have to create new Cri...
I was always sure (don't know why) that it's better to add annotations to variables, but while browsing the Hibernate doc http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#entity-hibspec-collection I noticed they tend to annotate the methods. So should I put my annotations before methods, like this:
@Entity
pu...
I read this article:
http://www.ibm.com/developerworks/java/library/j-genericdao.html
several times and believe I understand what it is saying. However, it is 4 years old and I have a JPA compliant Java application to contend with. In addition, I see that there is a JPATemplate in Spring that has some good functionality, but the Spri...
Is it possible with JPA to retrieve a instances of a non-entity classes with native queries?
I have a non-entity class that wraps two entities:
class Wrap{
Entity1 ent1;
Entity2 ent2
}
@Entity
class Entity1{
...
}
@Entity
class Entity2{
...
}
How can I do something like that?
Query q = entityManager.createNativeQuery("nativ...
What exactly does setting the length on a column do in JPA?
@Column(name = "middle_name", nullable = false, length = 32)
public String getMiddleName() {
return this.middleName;
}
I understand that you can use the annotations to generate the database schema (DDL) based on the entity objects, but does length do any sort of check or ...