All Questions

55
votes
2answers
56208 views

Validation Error: Value is not valid

I have a problem with a p:selectOneMenu, no matter what I do I cannot get JSF to call the setter on the JPA entity. JSF validation fails with this message: form:location: Validation Error: Value i...
23
votes
2answers
16625 views

JSF Controller, Service and DAO

I'm trying to get used to how JSF works with regards to accessing data (coming from a spring background) I'm creating a simple example that maintains a list of users, I have something like <h:dat...
338
votes
4answers
332494 views

JPA JoinColumn vs mappedBy

What is the difference between: @Entity public class Company { @OneToMany(cascade = CascadeType.ALL , fetch = FetchType.LAZY) @JoinColumn(name = "companyIdRef", referencedColumnName = "compa...
802
votes
14answers
485269 views

JPA EntityManager: Why use persist() over merge()?

EntityManager.merge() can insert new objects and update existing ones. Why would one want to use persist() (which can only create new objects)?
119
votes
22answers
274681 views

No Persistence provider for EntityManager named

I have my persistence.xml with the same name, using toplink, under META-INF directory. Then I have my code calling it with... EntityManagerFactory emfdb = Persistence.createEntityManagerFactory("agis...
167
votes
6answers
71971 views

Making a OneToOne-relation lazy

In this application we are developing, we noticed that a view was particularly slow. I profiled the view and noticed that there was one query executed by hibernate which took 10 seconds even if there ...
377
votes
13answers
304642 views

Difference between FetchType LAZY and EAGER in Java Persistence API?

I am a newbie to Java Persistence API and Hibernate. What is the difference between FetchType.LAZY and FetchType.EAGER in Java Persistence API?
302
votes
10answers
198839 views

Hibernate cannot simultaneously fetch multiple bags

Hibernate throws this exception during SessionFactory creation: org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags This is my test case: Parent.java @Ent...
91
votes
9answers
48134 views

Why is Hibernate Open Session in View considered a bad practice?

And what kind of alternative strategies do you use for avoiding LazyLoadExceptions? I do understand that open session in view has issues with: Layered applications running in different jvm's Transa...
98
votes
21answers
91925 views

Hibernate Annotations - Which is better, field or property access?

This question is somewhat related to Hibernate Annotation Placement Question. But I want to know which is better? Access via properties or access via fields? What are the advantages and disadvantages...

Previous Next