Given example from Hibernate docs and modifying it so that root level entity (Customer) is read-only while one of its collections (tickets) is read-write:
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class Customer {
...
@OneToMany(...)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public Sor...
First off, I hage to write this on my mobile. But I'll try to format it properly.
In Netbeans I created a jTable and bound it's values to a JPA result set. This works great. The qery contains a param which i set in the pre-create box of the "query result" component. So just before netbeans creates the query result i write this:
myQuery...
I wrote a named query in the entity class Voter
NamedQuery(name = "Voter.findvoter", query = "SELECT count(*) FROM Voter v WHERE v.voterID = :voterID" and where v.password= : password),
I want to call this named query and I also need to set voterID and password.
Can you help me. Thank you
...
Hello,
could someone help me to understand how can I define an entity with JPA mapping that has a relation with it self?
For example, my entity is CompanyDivision, divisionA contains divisionB, divisionC
and divisionB contains divisionB1, divisionB2
divisionA
divisionB
divisionB1
divisionB2
d...
Is it possible to configure Hibernate reverse engineering and code generation tool in such a way that one-to-many relation between tables is mapped to entities inheritance instead of enrites relation?
I have Person table and Employee table, which are related with the foreign key (Person contains basic information, Employee the rest). In...
I've got a simple java main which must write bean data on a PostgreSQL database. I use Entity manager to persist or update object. I use hibernate and toplink driver connection which are specified in persistence.xml file.
When I call em.persist(obj), nothing is saved on database, I don't know why. here is my simple code:
private static...
I am pretty new to GraniteDS..So far I have been able to successfully configure it to work with my remote java services as well as generate the equivalent AS3 files from my POJO's. But I am getting this strange error while building one of the classes using GAS3
[ERROR] C:\TestGDS_All\TestGDS-flex-remoteobjects\target\generated-sources\...
Hi, Im facing simple problem with searching entities by some (sub)string, which they might contain.
E.g. I have users user1, usr2, useeeer3, user4 and I will enter to search window "use" and I expect to return user1, useeer3, user4.
Im sure you know what I mean now. Is there any construction in JPA (JQPL)? It would be nice to search u...
The scenario is as below (tables shown)
Delivery table
------
id channelId type
10 100 fax
20 200 email
Fax table
----
id number
100 1234567
101 1234598
Email table
-----
id email
200 [email protected]
201 [email protected]
basically a one to one relationship between the delivery and the channel entity but since each concr...
This question is best described by a picture I think. I hope someone can help me. Thanks
...
I'm new to JPA. Now I have a question: what exactly does the owning side mean? I only have a rough idea of it. What is an explanation with some mapping examples (one to many, one to one, many to one)?
PS: the following text is an excerpt from the description of @OneToOne in Java EE 6 documentation. You can see the concept owning side in...
First off, we are using JPA 2.0 and Hibernate 3.5 as persistence provider on a PostgreSQL database.
We successfully use the sequence of the database via the JPA 2.0 annotations as an auto-generated value for single-field-surrogate-keys and all works fine.
Now we are implementing a bi-temporal database-scheme that requires a mixed key i...
I'm looking for the different ways to map an enum using JPA. I especially want to set the integer value of each enum entry and to save only the integer value.
@Entity
@Table(name = "AUTHORITY_")
public class Authority implements Serializable {
public enum Right {
READ(100), WRITE(200), EDITOR (300);
private int value;
...
Hello i have an Entity Exam
@Id
@GeneratedValue(strategy=GenerationType.TABLE)
private Long id;
.....
......
@ManyToMany
private List<Exam> exams;
@ManyToMany(mappedBy="id")
private List<Exam> parentExams;
The problem is that
@ManyToMany
private List<Exam> exams;
is ok works great...
but...
This may be related to my question from a few days ago, but I'm not even sure how to explain this part. (It's an entirely different parent-child relationship.)
In my interface, I have a set of attributes (Attribute) and valid values (ValidValue) for each one in a one-to-many relationship. In the Spring MVC frontend, I have a page for an...
I am building a framework that manage the access to the database.
the framework getting tasks from the user and handle a connection pooling that manage the access to the database. the user just send me SQL commands.
One of the feature that i would like to support is working with JPA, in this case i will provide entity manager. in some ...
I'm still new to JPA (and Hibernate, which I'm using as my provider), so maybe this just can't be done, but anyway...
Consider the following code:
@Entity
class Root {
@Id
private long id;
private String name;
@ElementCollection
private Map<ResourceType, Resource> resources;
...
}
@Entity
class ResourceType {
...
JPA promises to be vendor neutral for persistence and database. But I already know than some persistence frameworks like hibernate are not perfect (character encoding, null comparison) and you need to adapt your schema for each database. Because there is two layers (the persistence framework and database), I would imagine they're some wo...
I think JPA is nice and convenient ( not to mention standardising, as we used to have every individual programmer doing his/her own thing with a jdbc connection).
I would like to use something like jpa with C# to mysql and sqlserver.
...
I'm testing JPA, in a simple case File/FileVersions tables (Master/Details), with OneToMany relation, I have this problem: in FileVersions table, the field "file_id" (responsable for the relation with File table) accepts every values, not only values from File table.
How can I use the JPA mapping to limit the input in FileVersion.file_i...