Inside my JSF I did
<h:outputLabel value="Group:" for="group" />
<h:inputText id="group" value="#{newUserController.group.groupKey.groupId}" title="Group Id" />
Group.java
@Entity
public class Group {
@EmbeddedId
private GroupKey groupKey;
@ManyToOne
@JoinColumn(name="userId")
private User user;
//setter, g...
I created the JPA 2.0 entity classes for our whole database (~200 tables), and now each time I rebuild my application and start it for the first time I get these messages:
INFO: <entity_classname> actually got transformed
INFO: <entity_otherclassname> actually got transformed
...
And the output of these (info) messages in Glassfish is...
I have a Java web application that has a 'disconnected' Java Swing desktop app. Using the desktop app users connect to the internet and download data they need from a server. They can disconnect and use the application offline. When they reconnect to the internet they can sync their data back to the server.
The server itself is a Java...
I make use of: NetBeans IDE 6.7.1, GlassFish v2.1, Oracle 10g XE, JAVA 6 SE, JAVA 5 EE.
I have problem with an @ManyToMany annotation:
@ManyToMany(fetch=FetchType.EAGER)
@JoinTable(name="CUST_RENT_MOVIE", joinColumns={@JoinColumn(name="CUST_ID")}, inverseJoinColumns={@JoinColumn(name="TITLE")})
private Collection<CustRentMovie> rents ...
I've activated the auto-detect mode of Eclipselink 2.0 to find @Entity annotated classes:
<exclude-unlisted-classes>false</exclude-unlisted-classes>
But Eclipselink tells me that I should add an ID to my Entity:
Caused by: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence...
I got a OneToMany relation between User and Group
Group.java
@Entity
public class Group {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String groupid;
@ManyToOne
@JoinColumn(name="USER_FK")
private User user;
...
}
User.java
@Entity
public class User {
@Id
@GeneratedValue(strategy = Generat...
It generates MyISAM tables by default. I don't want to have to get it to generate a DDL script and then edit that if I can avoid it. I would also like to avoid changing the default table type of my MySQL installation unless I can do that for online one database. Any ideas?
...
Query q = em.createQuery("SELECT u FROM SSUser u WHERE u.emailId=?1")
.setParameter(1, email);
I thought this would be a valid query, but then I get:
No results for query: SELECT FROM SSUser u WHERE u.emailId=?1
What's the right way to express this query?
...
I'm using a ajax4jsf poller <a4j:poll> to check whether an entity has been updated in the database by another process. I want to reload the entity each time.
How can I force a reload?
Calling loadInstance() seems to have has no effect. (Polling works as expected)
@Name("myComponentHome")
public class MyComponentHome extends EntityHom...
Hi everyone,
This seems like such a bonehead question, but I've been chasing my tail around a tree all day. I have a Struts 2 + Spring3/JPA/Hibernate application that inserts a large set into the DB. In the set is a Java util date. I've checked the date just before the Dao inserts the rows and all the dates have the correct times. After...
Hi!
I'm catching javax.persistence.OptimisticLockException which works great, but I'm getting the stacktrace of StaleObjectStateException in my server log. I've checked and the getCause() on OptimisticLockException returns StaleObjectStateException, but why is it printed out to server.log? It's really annoying, I'm writing a test, where...
I'm using JPA 2 with Eclipselink 2 and a Derby in memory db for my tests. When I start my little test programm I get the following exception:
[EL Warning]: 2010-08-12 17:17:44.943--ServerSession(948252856)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.0.2.v20100323-r6872): org.eclipse.persistence.exceptions.Database...
Why can i remove elements of a bidirectional relation although only one side of the relation is managed in persistence context (Example I)? When i have an unidirectional Relationship that doesn't work (see Example II). Why?
Entities:
@Entity
Class User {
...
@OneToMany(mappedBy = "user")
private List<Process> processes;
...
Hi, there are two entity classes:
@Entity
public class Place implements Serializable {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id;
@OneToMany(mappedBy = "place")
private List<Event> events = new ArrayList<Event>();
private String name;
//getters setters
}
@Entity
public class Event implements...
I am working on a Java application that will use some Hibernate (annotated by JPA) classes, backed by a HSQLDB datasource (DBCP BasicDataSource). I am trying to manually tweak the HSQLDB ".script" file (which I can't for the life of me find the authoritative name for by web searching/reading the docs; it's only mentioned in passing) to ...
Why can't an entity class in JPA be final or have a final methods? Citing from here -
An entity class must follow these requirements:
...
The class must not be declared final. No methods or persistent instance variables must be declared final.
What is the reason? Is JPA subclassing the entity classes and redefining the me...
1.- I'm working Glassfish 2.1 with EcipseLink 2.0.0, so really using JPA 1.0 specification, and I have a stateless EJB that finds entities among other things. As far as i know JPA 1.0 defines a L1 cache that works at Persistence Context level (transaction level for stateless EJBs) but I can't figure out why the next code prints "Not same...
I've created two JPA entities (Client, InstrumentTraded) using Hibernate as a provider that have a ManyToMany relationship. After letting Hibernate generate the tables for MySQL it appears that the ManyToMany relationship table does not contain primary keys for the two foreign keys. This allows duplicate records in the many-to-many tab...
We have a JPA -> Hibernate -> Oracle setup, where we are only able to crank up to 22 transactions per seconds (two reads and one write per transaction). The CPU and disk and network are not bottlenecking.
Is there something I am missing? I wonder if there could be some sort of oracle imposed limit that the DBA's have applied?
Network...
I have small problem with view datas in h:dataTable item. I have native query which is working properly in database and in java:
SELECT SUM(price_list.first_class_price), SUM(price_list.second_class_price)
FROM price_list, connections
WHERE connections.id = price_list.id_connect
GROUP BY connections.source;
The method in EJB retur...