I have a managed bean for a JSF page which is doing JPA calls in the constructor to populate fields in the bean. I'm having a bit of trouble with another call to persist an entity (to populate data for testing). I'm expecting it to throw some sort of exception since it's not working, but I'm not getting anything. Just of the heck of it I...
I have a class hierarchy of JPA entities that all inherit from a BaseEntity class:
@MappedSuperclass
@EntityListeners( { ValidatorListener.class })
public abstract class BaseEntity implements Serializable {
// other stuff
}
I want all entities that implement a given interface to be validated automatically on persist and/or update....
Hi!
I'm having trouble handling IDs of my databse tables using OpenJPA and HSQLdb. I created an Abstract class where I handle annotations and stuff to remap into the DB:
// Property accessors
@Id
@Column(name = "IDTESTOBJEKT", unique = true, nullable = false)
public Integer getIdtestobjekt() {
return this.idtestobje...
Hi there, this is a quick question:
I have JPA entities where some properties are annotated with @Transient.
Shall I use these properties in equals/hashCode/toString methods?
My first thought is NO but.... I don't know why.
Tips?
Ideas?
Explanations?
Thanks in advance
...
I am trying to learn JPA, and Sun tutorial on JPA ("order" application) is hard to understand. The tutorial does not show me how the mapping between JPA and the actual Datasource, and does not explain various annotation they used in the tutorial. I did some google search and I did not find any thing good and basic. Does any of you know a...
We Want to persist a many to many table with EclipseLink, we have just tried by setting the collections and persist but it returns error cause it seems that is requesting for all of the collections in the hierarchy, we are doing this cause the system did not mapped that table cause it has all of its fields as foreign keys so instead of ...
Hello I tried one application which is used to store First 100 users in my domain to the table using JPA.But its returning Server Error. Pealse Help me.
This is the code i tried..
public class AppsProvisioning {
public String m[]=new String[1000];
public int a;
final EntityManager em = EMFService.get().createEntityMa...
I'm trynig to use @OrderColumn annotation with Hibernate 3.5
@OneToMany(mappedBy = "parent",fetch=FetchType.EAGER, cascade=CascadeType.ALL)
@OrderColumn(name = "pos")
private List<Children> childrenCollection;
When retrieving data everyting works fine. But I can't make it to reorded elements in List and save new order to database.
...
Hi all, im new in hibernate and JPA and i have some problems with annotations.
My target is to create this table in db (PERSON_TABLE with personal-details)
ID ADDRESS NAME SURNAME MUNICIPALITY_ID
First of all, i have a MUNICIPALITY table in db containing all municipality of my country.
I mapped this table in this ENTI...
I was wondering what is the best practice for a JPA model in Lift? I
noticed that in the jpa demo application, there is just a Model object
that is like a super object that does everything. I don't think this
can be the most scalable approach, no?
Is it is wise to still do the DAO pattern in Lift? For example,
there's some code that loo...
I have the following relationships in JPA (hibernate).
Object X has two subclasses, Y and Z.
Object A has a manyToOne relationship to object X. (Note, this is a one-sided relationship so object X cannot see object A).
Now, I want to get the max value of a column in object A, but only where the relationship is of a specific subtype, ie...
Java EJB's EntityManager does not update data from a Consumer.
A Consumer logs into a shop, buys some stuff and wants to look at his shopping-history. Everything is displayed but his last purchase. If he logs out and in, it shows.
I have used JPA to persist buys/purchases (that are mapped to the Consumer)to DB. It seems like purchases...
I am using JUnit 4 to test Dao Access with Spring (annotations) and JPA (hibernate). The datasource is configured through JNDI(Weblogic) with an ORacle(Backend). This persistence is configured with just the name and a RESOURCE_LOCAL transaction-type
The application context file contains notations for annotations, JPA config, transaction...
EDIT
Hi all.
WHAT I TRY TO GET
I want a table that represents a list of personal details, this table is called PERSON and must have this columns:
ID NAME SURNAME STREET ID_CITY
Well, i already have a table in my db that contains all municipalities of my country, this table is called MUNICIPALITY and has this column...
I am making a POS like system. I wonder how to map subclass using JPA (this is for my DAO). Product class has product details and OrderProduct class has information about the Product and details about the order.
@Entity
@Table(name="products")
public class Product implements Serializable{
@Id
@Column(name="id")
@GeneratedVal...
I have a terrible problem that hopefully has a very simple answer. I am running out of memory when I perform a basic
If I have code like this:
MyEntity myEntity;
for (Object id: someIdList) {
myEntity = find(id);
// do something basic with myEntity
}
And the find() method is a standard EntityManager related method:
public My...
I create an Enterprise Application CustomerApp that also generated two projects CustomerApp-ejb and CustomerApp-war. In the CustomerApp-ejb, I create a SessionBean call CustomerSessionBean.java as below.
package com.customerapp.ejb;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import j...
I'm using persistence API and want to load jdbc URL from web.xml. URL should be a context parameter of servlet. I can't find how to construct EntityManagerFactory not using persistence.xml. May be I should create PersistenceUnit in servlet and set some parameters? Can you give me some short example?
Thank you
...
I have this parent class:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "BSEntity")
@DiscriminatorColumn(name = "resourceType", discriminatorType = DiscriminatorType.STRING, length = 32)
public abstract class BaseEntity {
and the subclass
@Entity
@Table(name = "BSCategory")
@DiscriminatorValue("Category")
pub...
I'm getting the following error while saving a object. However similar configuration is working for other model objects in my projects. Any help would be greatly appreciated.
@Entity
@Table(name = "ENROLLMENT_GROUP_MEMBERSHIPS", schema = "LEAD_ROUTING")
public class EnrollmentGroupMembership implements Serializable, Comparable,Auditabl...