The tag has no usage guidance.

learn more… | top users | synonyms

21
votes
5answers
778 views

Is staying implementation agnostic really worth it?

I have a project that I'm working on currently using Tomcat, Spring 4, Spring Security, MySQL, and JPA w/ Hibernate. I picked JPA from the standpoint that it's suppose to make swapping out the ...
20
votes
4answers
2k views

How can I use unit tests and TDD to test an app that relies mostly on database CRUD operations?

At work, one of my projects is mostly about taking data passed in from an external client and persisting it in a database. It's a Java enterprise app using JPA and most of our logic revolves around ...
11
votes
2answers
15k views

Entity to DTO Usage

Been trying to come up with a flow for a basic tiered web application, and have been reading conflicting information online. What I'm trying to figure out is if there is an advantage to still using ...
6
votes
1answer
7k views

IntelliJ with Maven compilation

I have a project that needs Hibernate jars. I added them as dependencies in the pom.xml and Maven compiles my project well. However, in the IDE, all annotations and calls to Hibernate API are marked ...
5
votes
1answer
529 views

Is this database design good? What JPA Entities should I create for this design?

I am trying my hands on JPA. For this I am thinking of using the example of a student admission process as shown in the diagram below. Is this design good ? Any suggestions for improvement are ...
4
votes
3answers
1k views

When Business Object fields should not exactly reflect database columns

Main advantage with Hibernate annotations is the fact that a simple POJO (also called a Business Object the most of time) can become persistent through Hibernate annotations (or actually JPA) . In ...
4
votes
1answer
474 views

ORM: runtime proxies vs bytecode instrumentation

What are the benefits of using runtime proxies with an ORM provider like Hibernate or EclipseLink compared to bytecode instrumentation/enhancement? I know that bytecode instrumentation helps to ...
3
votes
1answer
1k views

When using Java Persistence API (JPA), which layer owns the entities?

When working with annotations on entities in JPA, do these entities belong to the model layer or the persistence layer? Does there have to be some kind of clone of the entities (simple JavaBeans) in ...
3
votes
1answer
267 views

ORM: Design of the service layer

I'm currently writing a medium sized web-application and find myself asking this question many times. For example, let's say there are users, which have files (one-to-many). How should the UI access ...
2
votes
3answers
293 views

in doubt of using code generators

I am now entering the world of java ee 6. And I am supposed to used different technologies like jsf, jpa, different kinds of beans and all that stuff. I am learning using the netbeans IDE, which is, ...
2
votes
4answers
474 views

Should OO design, or database design, drive the coding of my @Entity classes?

I have two classes that I want related to each other in an JEE application using JPA2. In an OO world, I would say that a Chatroom has an attribute List messages. In the relational world composition ...
2
votes
2answers
204 views

What's the correct approach to DAO layer in presence of ORM framework

I'm using JPA/Hibernate but probably it doesn't limit question. Currently I'm writing my data access code in my web controller classes. Thanks to JPA, in most cases this code is very simple, ...
2
votes
2answers
363 views

When designing data models for JPA, what's the best way to make use of polymorphism?

I've been asked to support a Java EE application. The data model was poorly-designed and will not support several necessary use cases; so I'm developing a new data model using EclipseLink (the old one ...
2
votes
0answers
25 views

Approach for querying an arbitrary set of user submitted fields and values in Spring application? Like a shopping site sidebar search?

I am working on a Spring Boot and Angular application which has a requirement to search based on any number of the available filters being applied to a list. For example, a user searches on 'Title' ...
1
vote
1answer
1k views

Has JPA replaced CMP?

No question too stupid right :) Came across this on wikipedia The Java Persistence API replaces the persistence solution of EJB 2.0 CMP (Container Managed Persistence). My understanding was ...
1
vote
1answer
2k views

Is Java's ElementCollection Considered a Bad Practice?

From my understanding, an ElementCollection has no primary key, is embedded with the class, and cannot be queried. This sounds pretty hefty, but it allows me the comfort of writing an enum class which ...
1
vote
2answers
3k views

Designing complex query builders in java/jpa/hibernate

I need to build complex sql queries programatically, based on large filter conditions. For example, below are few sample/hypothitical filter conditions, based on which i need to fetch users Country: ...
1
vote
1answer
80 views

auto generated web CMS for pre-existing SQL db?

What I'm looking for is a way to auto-generate a simple web-based CMS for a simple pre-existing SQL database. To be used by 'app administrators', not the general public. Something that: allows ...
1
vote
3answers
310 views

Limiting complexity in JPA programs Java/Hibernate

I've been working on a new application for some months now. It's my first big JPA program, and is still in the early stages. However, the complexity of my JPA object tree is becoming a growing problem....
1
vote
1answer
889 views

Producing JSON objects from JPA entities in REST API

I have a REST service producing JSON and consuming JSON. A lot of this are simple CRUD operations. My initial idea was to simply use the DAOs directly in the controller: @ResponseBody() @...
1
vote
0answers
21 views

How do I properly manage EntityManagerFactory and EntityManagers for long running tasks?

We're building a JavaFX application that connects to a remote Oracle database using EclipseLink on one end and a SOAP service on the other end. We're writing long running transactions that will pull ...
0
votes
2answers
1k views

Is JSF and JPA worth learning? [closed]

I'm attending a company sponsored training event for JSF and JPA that crams 10 days of training into 5 days. I plan on getting all that I can out of the class, but there is no "final exam".
0
votes
1answer
355 views

DTO and JPA Version

I have DB tables representing Employees and Departments. The server side(JavaEE) contains JPA entities representing the same. The client is a standalone client and communicates with the server using ...
0
votes
1answer
1k views

Where to put JPA annotations? Field, or getter?

version in field: @Column(name = "SAMPLE_STRING") private String sampleString; public String getSampleString(){ return sampleString; } version in getter: private String sampleString; @...
0
votes
1answer
976 views

Creating a separate project for JPA entities

Where I work it is a common practice to create a separate for JPA entities and a project for the web application (the WAR). So basically you have (at least) two project for each application - appJPA ...
0
votes
0answers
12 views

JPA: Property/encapsulated objects instead of fields

I'm moving to JPA (JavaEE, Eclipselink) from a very large C# project. The classes were not using simple fields but Property objects. Example: //C# public class State : DataObject<State> //base ...
0
votes
0answers
32 views

How does Hibernate Cascade on OneToOne work under the hood

I have the following entities corresponding to tables into DB: User, UserAttempt; User has a FK to UserAttempt, and UserAttempt has no knowledge of User. If I do the following inside a transactional ...
0
votes
0answers
40 views

JpaPagingItemReader : page size and commit interval of chunk

I have questions regarding page size of JpaPagingItemReader and commit-interval of job chunk. As per JpaPagingItemReader documentation, it says "..In order to reduce the memory usage for large ...
0
votes
0answers
49 views

Why is some config in persistence.xml property-based vs. element-based

In persistence.xml the configuration of the Database connection can be done using <jta-data-source>java:/DefaultDS</jta-data-source> or using the <properties> like <...
0
votes
0answers
17 views

Conceptually, how should a unidirectional multivalued relationship be implemented?

Ok, I'm trying not to upset the programmers list, but not so successful so far. My apologies. I'm trying to understand, conceptually and based on experience, which is the correct way for a JPA ...
0
votes
1answer
334 views

How to avoid LazyInitializationException using Hibernate and Jersey

I am working with Spring Boot + Jersey + JPA/Hibernate to build a RESTful API. The issue I am encountering right now is when I have a relationship in my JPA Entity that is lazy loaded I get a lazy ...
0
votes
1answer
227 views

Can I ditch the persistence.xml file on JBoss?

I have a Spring based app where another programmer is using JPA's persistence.xml file to define the setup of hibernate and to define the entities that are being persisted. The app is using Spring's ...
0
votes
1answer
38 views

Handle publishing data across environments

I am rewriting a website that has a back-end database for containing meta-data that is displayed to the user when they enter a text code. Background: The old/existing system stored this data in XML ...
-1
votes
0answers
25 views

How to hack Hibernate to see generated proxy class for every entity? [on hold]

Can we make Hibernate to generate proxies at compile time and how?