cancel
Showing results for 
Search instead for 
Did you mean: 

JPA is expansive solution when memory is critical

Former Member
0 Kudos

Hi EveryBody

I hosting service is very critical about memory and I have only 64MB with private tomcat. Is old JDBC way is better in my case or JPA is also recourse saving solution.

if statement and preparedstatement is replace by JPA. comparatively how much is the difference.

Any idea or any words in this is really appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello

If you

1. Don't use cache

2. You follow best practices when you write your JPA application

3. You consider a risk of critical memory when you design your application

In this case there will be no much defference between JPA and JDBC. I think there is a good documentation about how to tune JPA application (But I'm not sure about SAP JPA)

For example: You have a table with 20 colums and you want to show only NAME column in user interface. With JDBC you can write simple SQL - SELECT NAME FROM TABLE. With JPA you have to make sure that you don't select unnecessary 19 colums.

Former Member
0 Kudos

Hi Sergey Aleksandrov

/****

With JPA you have to make sure that you don't select unnecessary 19 colums

*****/

In JPA we select object so how can we avoid to select the rest of the 19 column. Please give me any link or a sample JPA-SQL to get the solution

Thankyou

Former Member
0 Kudos

You can use JPQL, for example

SELECT c.id, c.name FROM Customer c JOIN .. WHERE ...

Where <b>Customer</b> is your domain model object. The result will contain a collection of customer objects where only 2 attributes will be filled.

Former Member
0 Kudos

Hi Sergey Aleksandrov

If I make all the table with no relation. This will help me more for saving memory. And can I able to run JPSQL on 2 object(tables) when the object has no join/relation implemented.

Thank You

Vlado
Advisor
Advisor
0 Kudos

Actually, the result will be a List of Object[2], where for each element <b>e</b> of the List <b>e[0]</b> is the Customer id (e.g. Integer) and <b>e[1]</b> is the Customer name (e.g. String).

Answers (0)