Hi,
I want to use JPA (eclipselink) to get data from my database. The database is changed by a number of other sources and I therefore want to go back to the database for every find I execute. I have read a number of posts on disabling the cache but this does not seem to be working. Any ideas?
I am trying to execute the following code:...
I have a table like so:
mysql> show create table foo;
CREATE TABLE foo
(
network bigint NOT NULL,
activeDate datetime NULL default '0000-00-00 00:00:00',
...
)
In the domain object, FooVO the activeDate member is annotated as Temporal.
If I don't set activeDate to a valid Date instance, a new record is inserted with NULLs....
I have a JPA entity that stores a fk id, a boolean and a timestamp:
@Entity
public class ChannelInUse implements Serializable {
@Id
@GeneratedValue
private Long id;
@ManyToOne
@JoinColumn(nullable = false)
private Channel channel;
private boolean inUse = false;
@Temporal(TemporalType.TIMESTAMP)
private Date inUseAt = n...
I'm using JPA 1.0 with hibernate as my provider. Inside an entitymanager transaction, if a series of native queries are run (which include DELETE sql statements) and an error occurs, will the native queries rollback too on the error?
I ran into a deadlock problem in an oracle database and I noticed that it left the database inconsistent...
Given the following two tables:
CREATE TABLE `x` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`name_hash` char(32) NOT NULL,
`access_time` bigint(20) unsigned NOT NULL,
`name` varchar(1024) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_hash` (`name_hash`),
KEY `access_time` (`access_time`),
CONSTRAINT `x_ibfk_1` ...
I have an Entity with a enum attribute and a couple on NamedQueries. One of these NamedQueries has the enum attribute as a parameter i.e.
SELECT m FROM Message m WHERE m.status = :status
When i try to ru n the query i get the following error;
Caused by: java.lang.IllegalArgumentException: You have attempted to set a value of type clas...
I'm trying to use PostgreSQL as the database for Hibernate/JPA. However, I get an error when executing a simple query. My query is as follows:
SELECT DISTINCT p FROM UserProfile p ORDER BY :order
When I execute the query, I'll pass in a value like "lastLoginDate" for :order. However, I get the following exception when trying to exe...
Quick version:
We're looking for a way to force a transaction to rollback when specific situations occur during the execution of a method on a backing bean but we'd like the rollback to happen without having to show the user a generic 500 error page. Instead, we'd like the user to see the form she just submitted and a FacesMessage that i...
I'm trying to implement some basic entities using Hibernate/JPA. Initially the code was deployed on MySQL and was working fine. Now, I'm porting it over to use PostgreSQL. In MySQL, my entity class defines its primary key as an auto-incrementing long value with the following syntax:
@Id
@GeneratedValue(strategy = GenerationTy...
Hi everyone,
I am trying to use an @JoinColumn as an @Id using JPA and I am getting SerializationExceptions, "Could not serialize."
UserRole.java:
@Entity
@Table(name = "authorities")
public class UserRole implements Serializable {
@Column(name = "authority")
private String role;
@Id
@ManyToOne
@JoinColumn(name = "username")
...
I have a property field in a class that is of type javax.xml.datatype.Duration. It basically represents a time span (e.g. 4 hours and 34 minutes).
JPA is telling me it is an invalid type, which doesn't shock me.
Whats a good solution this? I could implement my own Duration class, but I don't know how to get JPA to "accept" it as a ...
I have an enterprise application that uses a single database, but the application needs to support mysql, oracle, and sql*server as installation options. To try to remain portable we are using JPA annotations with Hibernate as the implementation. We also have a test-bed instance of each database running for development.
The app is bui...
Found some examples of @NamedQuery annotations,e.g.:
@NamedQuery(name="employeeBySsn" query="select e from Employee e where e.ssn = :ssn")
what does parameter e mean?
the second usage of it seems like alias name of table and what does "select e" part mean?
...
I need make OUTER JOIN of two entities in JPA (saying master, detail), but the problem that at the entity level there are no relations (and i don't want add it).
@Entity
class Master
{
@Column(name="altKey")
Integer altKey;
}
@Entity
class Detail
{
@Column(name="altKeyRef")
@Basic (optional = true)
Integer altKeyRef...
Hibernate does not allow me to persist an object that contains an null embedded object with an integer field. For example, if I have a class called Thing that looks like this
@Entity
public class Thing {
@Id
public String id;
public Part part;
}
where Part is an embeddable class that looks like this
@Embeddable
public...
I have a fairly large (new) project in which we have annotated many domain classes with JPA mappings. Now it is time to implement many named queries -- some entities may have as many as 15-20 named queries. I am thinking that writing these named queries in annotations will clutter the source files and therefore am considering putting t...
Environment: JPA 1, Hibernate 3.3.x
I have an JPA entity class (User), how do I selectively fetch member variables say (first_name, last_name) instead of fetching all user attributes using the JPA api.
...
GWT with JPA
There are two projects in my eclipse workspace, let's name them:
-JPAProject
-GWTProject
JPAProject contains JPA configuration stuff (persistence.xml, entity classes and so on). GWTProject is an examplary GWT project (taken from official GWT tutorial).
Both projects work fine alone. That is, I can create EMF (EntityManag...
I am not able to get child entities to load once they are persisted on Google App Engine. I am certain that they are saving because I can see them in the datastore. For example if I have the following two entities.
public class Parent implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Extension...
Say I have 5 tables,
tblBlogs tblBlogPosts tblBlogPostComment tblUser tblBlogMember
BlogId BlogPostsId BlogPostCommentId UserId BlogMemberId
BlogTitle BlogId CommentText FirstName UserId
PostTitle BlogPostsId BlogId
...