SlideShare uma empresa Scribd logo
1 de 14
Common Pitfalls
1. Not specifying columns in your select statement
(select *)
.
.
StringBuffer queryString = new StringBuffer();
queryString.append("SELECT DISTINCT o.name, o.code, o.price, d.discount “);
queryString.append("FROM com.exist.model.Order as o, “);
queryString.append("com.exist.model.Discounts as d “);
.
.
.
Session session = sessionFactory.getCurrentSession();
Query selectQuery = session.createQuery(queryString.toString());
List<Order> orders= selectQuery.list();
.
.
.
List<OrderTo> orderTo = new ArrayList<OrderTo>();
...
for(Order order:orders){
OrderTo oto = new OrderTo
oto.setName(order.getName());
.
.
.
orderTo.add(oto);
}
.
.
.
2. Select and Transfer
.
.
.
StringBuffer queryString = new StringBuffer();
queryString.append("SELECT DISTINCT new com.exist.to.OrdersTO ");
queryString.append("(o.name, o.code, o.price, d.discount) ");
queryString.append("FROM com.exist.model.Orders as o, ");
queryString.append("com.exist.model.Discounts as d “);
.
.
.
Session session = sessionFactory.getCurrentSession();
Query selectQuery = session.createQuery(queryString.toString());
.
.
.
List<OrdersTO> data = selectQuery.list();
3. Not delegating computations
.
.
.
double bills = someService.getBills(referenceNo);
double payments = someService.getPayments(referenceNo)
double due = bills - payments;
.
.
.
public class Computations {
private SomeService someService;
private double bills;
private double payments;
private double due;
public Computations(SomeService someService, String reference) {
bills = someService.getBills(referenceNo);
payments = someService.getPayments(referenceNo)
due = bills - payments;
}
... <getters of bills, payments and due>
}
.
.
.
Computations computations = new Computations(someService, referenceNo);
double bills = computations.getBills();
double payments = computations.getPayments();
double due = computations.getDue();
.
.
.
4. equals String literal
variable.equals(“String Literal”);
“String literal”.equals(variable);
5. Computing using double or
Double
double minuend = 1.1d;
double subtrahend = 1.0d;
double difference = minuend – subtrahend;
Or
Double minuend = 1.1d;
Double subtrahend = 1.0d;
Double difference = minuend.doubleValue() – subtrahend.doubleValue();
BigDecimal minuend = new BigDecimal(1.1).setScale(2, RoundingMode.HALF_EVEN);
BigDecimal subtrahend = 1.0d;
BigDecimal difference = minuend.subtract(subtrahend);
6. using objects in if
If (object.getBooleanProperty()) {
...
}
if (object!=null && object.getBooleanProperty()) {
...
}
Or
if (object!=null && object.getNumericProperty()>0) {
...
}
Thanks!

Mais conteúdo relacionado

Mais procurados

Two scoopsofdjango common patterns for forms
Two scoopsofdjango   common patterns for formsTwo scoopsofdjango   common patterns for forms
Two scoopsofdjango common patterns for formsShih-yi Wei
 
Two scoopsofdjango ch16 dealing with the user model
Two scoopsofdjango ch16   dealing with the user modelTwo scoopsofdjango ch16   dealing with the user model
Two scoopsofdjango ch16 dealing with the user modelShih-yi Wei
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEDarwin Durand
 
The Ring programming language version 1.5.4 book - Part 20 of 185
The Ring programming language version 1.5.4 book - Part 20 of 185The Ring programming language version 1.5.4 book - Part 20 of 185
The Ring programming language version 1.5.4 book - Part 20 of 185Mahmoud Samir Fayed
 
Analyzing Functional Programs
Analyzing Functional ProgramsAnalyzing Functional Programs
Analyzing Functional ProgramsDave Cleaver
 
Array imp of list
Array imp of listArray imp of list
Array imp of listElavarasi K
 
The Ring programming language version 1.5.4 book - Part 27 of 185
The Ring programming language version 1.5.4 book - Part 27 of 185The Ring programming language version 1.5.4 book - Part 27 of 185
The Ring programming language version 1.5.4 book - Part 27 of 185Mahmoud Samir Fayed
 

Mais procurados (13)

Two scoopsofdjango common patterns for forms
Two scoopsofdjango   common patterns for formsTwo scoopsofdjango   common patterns for forms
Two scoopsofdjango common patterns for forms
 
Two scoopsofdjango ch16 dealing with the user model
Two scoopsofdjango ch16   dealing with the user modelTwo scoopsofdjango ch16   dealing with the user model
Two scoopsofdjango ch16 dealing with the user model
 
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
 
Specs2
Specs2Specs2
Specs2
 
The Ring programming language version 1.5.4 book - Part 20 of 185
The Ring programming language version 1.5.4 book - Part 20 of 185The Ring programming language version 1.5.4 book - Part 20 of 185
The Ring programming language version 1.5.4 book - Part 20 of 185
 
Data Structure
Data StructureData Structure
Data Structure
 
Analyzing Functional Programs
Analyzing Functional ProgramsAnalyzing Functional Programs
Analyzing Functional Programs
 
Validation
ValidationValidation
Validation
 
Sql
SqlSql
Sql
 
Array imp of list
Array imp of listArray imp of list
Array imp of list
 
Sql
SqlSql
Sql
 
The Ring programming language version 1.5.4 book - Part 27 of 185
The Ring programming language version 1.5.4 book - Part 27 of 185The Ring programming language version 1.5.4 book - Part 27 of 185
The Ring programming language version 1.5.4 book - Part 27 of 185
 
Scala on Your Phone
Scala on Your PhoneScala on Your Phone
Scala on Your Phone
 

Destaque

2010 NYC Presentation
2010 NYC Presentation2010 NYC Presentation
2010 NYC Presentationbfum316
 
Bc 403(Harman S. Gahir)
Bc 403(Harman S. Gahir)Bc 403(Harman S. Gahir)
Bc 403(Harman S. Gahir)Harman Gahir
 
Wire Checklist
Wire ChecklistWire Checklist
Wire Checklistintrahome
 
MoZeus Worldwide 2012
MoZeus Worldwide 2012MoZeus Worldwide 2012
MoZeus Worldwide 2012slubey
 
2010 q3 google_earnings_slides
2010 q3 google_earnings_slides2010 q3 google_earnings_slides
2010 q3 google_earnings_slidesrabier
 
Prepositions workshop
Prepositions workshopPrepositions workshop
Prepositions workshopdarkcrow08
 
The Ideal Shopping Cart + Streamlining The Checkout Process
The Ideal Shopping Cart + Streamlining The Checkout ProcessThe Ideal Shopping Cart + Streamlining The Checkout Process
The Ideal Shopping Cart + Streamlining The Checkout ProcessGoECart
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQueryExist
 
Pavasarisveneranda
PavasarisvenerandaPavasarisveneranda
PavasarisvenerandaParlielupe
 
Serial Entrepreneur Series - All Rights Reserved, 2012
Serial Entrepreneur Series - All Rights Reserved, 2012Serial Entrepreneur Series - All Rights Reserved, 2012
Serial Entrepreneur Series - All Rights Reserved, 2012Philogic
 
How To Make Your Day Last Longer: Time Management in Marketing Projects
How To Make Your Day Last Longer: Time Management in Marketing Projects How To Make Your Day Last Longer: Time Management in Marketing Projects
How To Make Your Day Last Longer: Time Management in Marketing Projects Alek Kowalczyk
 
C:\fakepath\going door to-door a look at the numbers
C:\fakepath\going door to-door a look at the numbersC:\fakepath\going door to-door a look at the numbers
C:\fakepath\going door to-door a look at the numbersColleton Baptist Association
 

Destaque (20)

2010 NYC Presentation
2010 NYC Presentation2010 NYC Presentation
2010 NYC Presentation
 
Bc 403(Harman S. Gahir)
Bc 403(Harman S. Gahir)Bc 403(Harman S. Gahir)
Bc 403(Harman S. Gahir)
 
Wire Checklist
Wire ChecklistWire Checklist
Wire Checklist
 
Wistner
WistnerWistner
Wistner
 
MoZeus Worldwide 2012
MoZeus Worldwide 2012MoZeus Worldwide 2012
MoZeus Worldwide 2012
 
2010 q3 google_earnings_slides
2010 q3 google_earnings_slides2010 q3 google_earnings_slides
2010 q3 google_earnings_slides
 
Prepositions workshop
Prepositions workshopPrepositions workshop
Prepositions workshop
 
The Ideal Shopping Cart + Streamlining The Checkout Process
The Ideal Shopping Cart + Streamlining The Checkout ProcessThe Ideal Shopping Cart + Streamlining The Checkout Process
The Ideal Shopping Cart + Streamlining The Checkout Process
 
Numeros
NumerosNumeros
Numeros
 
Rutinas 2
Rutinas 2Rutinas 2
Rutinas 2
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
Mgul slide
Mgul slideMgul slide
Mgul slide
 
Let's Code
Let's CodeLet's Code
Let's Code
 
Pavasaris
PavasarisPavasaris
Pavasaris
 
Pavasarisveneranda
PavasarisvenerandaPavasarisveneranda
Pavasarisveneranda
 
Serial Entrepreneur Series - All Rights Reserved, 2012
Serial Entrepreneur Series - All Rights Reserved, 2012Serial Entrepreneur Series - All Rights Reserved, 2012
Serial Entrepreneur Series - All Rights Reserved, 2012
 
How To Make Your Day Last Longer: Time Management in Marketing Projects
How To Make Your Day Last Longer: Time Management in Marketing Projects How To Make Your Day Last Longer: Time Management in Marketing Projects
How To Make Your Day Last Longer: Time Management in Marketing Projects
 
Review 1st period
Review 1st periodReview 1st period
Review 1st period
 
New Arrivals 2010 oct-16-31
New Arrivals 2010 oct-16-31New Arrivals 2010 oct-16-31
New Arrivals 2010 oct-16-31
 
C:\fakepath\going door to-door a look at the numbers
C:\fakepath\going door to-door a look at the numbersC:\fakepath\going door to-door a look at the numbers
C:\fakepath\going door to-door a look at the numbers
 

Semelhante a Common Pitfalls Experienced in Java

The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 46 of 189
The Ring programming language version 1.6 book - Part 46 of 189The Ring programming language version 1.6 book - Part 46 of 189
The Ring programming language version 1.6 book - Part 46 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 43 of 181
The Ring programming language version 1.5.2 book - Part 43 of 181The Ring programming language version 1.5.2 book - Part 43 of 181
The Ring programming language version 1.5.2 book - Part 43 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.5.3 book - Part 54 of 184
The Ring programming language version 1.5.3 book - Part 54 of 184The Ring programming language version 1.5.3 book - Part 54 of 184
The Ring programming language version 1.5.3 book - Part 54 of 184Mahmoud Samir Fayed
 
C# Starter L04-Collections
C# Starter L04-CollectionsC# Starter L04-Collections
C# Starter L04-CollectionsMohammad Shaker
 
The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212Mahmoud Samir Fayed
 
Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Vagif Abilov
 
Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012Sandeep Joshi
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Traceoysteing
 
The Ring programming language version 1.7 book - Part 40 of 196
The Ring programming language version 1.7 book - Part 40 of 196The Ring programming language version 1.7 book - Part 40 of 196
The Ring programming language version 1.7 book - Part 40 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 35 of 180
The Ring programming language version 1.5.1 book - Part 35 of 180The Ring programming language version 1.5.1 book - Part 35 of 180
The Ring programming language version 1.5.1 book - Part 35 of 180Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 44 of 185
The Ring programming language version 1.5.4 book - Part 44 of 185The Ring programming language version 1.5.4 book - Part 44 of 185
The Ring programming language version 1.5.4 book - Part 44 of 185Mahmoud Samir Fayed
 
Refactoring 메소드 호출의 단순화
Refactoring 메소드 호출의 단순화Refactoring 메소드 호출의 단순화
Refactoring 메소드 호출의 단순화HyeonSeok Choi
 

Semelhante a Common Pitfalls Experienced in Java (20)

The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84The Ring programming language version 1.2 book - Part 32 of 84
The Ring programming language version 1.2 book - Part 32 of 84
 
The Ring programming language version 1.6 book - Part 46 of 189
The Ring programming language version 1.6 book - Part 46 of 189The Ring programming language version 1.6 book - Part 46 of 189
The Ring programming language version 1.6 book - Part 46 of 189
 
The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210The Ring programming language version 1.9 book - Part 53 of 210
The Ring programming language version 1.9 book - Part 53 of 210
 
The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31The Ring programming language version 1.4.1 book - Part 13 of 31
The Ring programming language version 1.4.1 book - Part 13 of 31
 
The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196The Ring programming language version 1.7 book - Part 48 of 196
The Ring programming language version 1.7 book - Part 48 of 196
 
The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31The Ring programming language version 1.5 book - Part 8 of 31
The Ring programming language version 1.5 book - Part 8 of 31
 
The Ring programming language version 1.5.2 book - Part 43 of 181
The Ring programming language version 1.5.2 book - Part 43 of 181The Ring programming language version 1.5.2 book - Part 43 of 181
The Ring programming language version 1.5.2 book - Part 43 of 181
 
The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184The Ring programming language version 1.5.3 book - Part 44 of 184
The Ring programming language version 1.5.3 book - Part 44 of 184
 
The Ring programming language version 1.5.3 book - Part 54 of 184
The Ring programming language version 1.5.3 book - Part 54 of 184The Ring programming language version 1.5.3 book - Part 54 of 184
The Ring programming language version 1.5.3 book - Part 54 of 184
 
C# Starter L04-Collections
C# Starter L04-CollectionsC# Starter L04-Collections
C# Starter L04-Collections
 
The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212The Ring programming language version 1.10 book - Part 54 of 212
The Ring programming language version 1.10 book - Part 54 of 212
 
Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#
 
For Beginners - C#
For Beginners - C#For Beginners - C#
For Beginners - C#
 
string tokenization
string tokenizationstring tokenization
string tokenization
 
Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Trace
 
The Ring programming language version 1.7 book - Part 40 of 196
The Ring programming language version 1.7 book - Part 40 of 196The Ring programming language version 1.7 book - Part 40 of 196
The Ring programming language version 1.7 book - Part 40 of 196
 
The Ring programming language version 1.5.1 book - Part 35 of 180
The Ring programming language version 1.5.1 book - Part 35 of 180The Ring programming language version 1.5.1 book - Part 35 of 180
The Ring programming language version 1.5.1 book - Part 35 of 180
 
The Ring programming language version 1.5.4 book - Part 44 of 185
The Ring programming language version 1.5.4 book - Part 44 of 185The Ring programming language version 1.5.4 book - Part 44 of 185
The Ring programming language version 1.5.4 book - Part 44 of 185
 
Refactoring 메소드 호출의 단순화
Refactoring 메소드 호출의 단순화Refactoring 메소드 호출의 단순화
Refactoring 메소드 호출의 단순화
 

Mais de Exist

Postgres Powers Digital Transformation in Southeast Asia – Success Stories
Postgres Powers Digital Transformation in Southeast Asia – Success StoriesPostgres Powers Digital Transformation in Southeast Asia – Success Stories
Postgres Powers Digital Transformation in Southeast Asia – Success StoriesExist
 
Understanding Blockchain and Its Business Benefits
Understanding Blockchain and Its Business BenefitsUnderstanding Blockchain and Its Business Benefits
Understanding Blockchain and Its Business BenefitsExist
 
ブロックチェーンのビジネス上の利点を理解する
ブロックチェーンのビジネス上の利点を理解するブロックチェーンのビジネス上の利点を理解する
ブロックチェーンのビジネス上の利点を理解するExist
 
How to Select the Right Automation Testing Tool
How to Select the Right Automation Testing ToolHow to Select the Right Automation Testing Tool
How to Select the Right Automation Testing ToolExist
 
Advancing Global Competitiveness Through Digital Transformation and Big Data ...
Advancing Global Competitiveness Through Digital Transformation and Big Data ...Advancing Global Competitiveness Through Digital Transformation and Big Data ...
Advancing Global Competitiveness Through Digital Transformation and Big Data ...Exist
 
Exist Company Profile
Exist Company ProfileExist Company Profile
Exist Company ProfileExist
 
Exist Company Profile (Nihongo)
Exist Company Profile (Nihongo)Exist Company Profile (Nihongo)
Exist Company Profile (Nihongo)Exist
 
DX(デジタルトランスフォーメーション)とビッグデータでグローバル競争力強化を図ります
DX(デジタルトランスフォーメーション)とビッグデータでグローバル競争力強化を図りますDX(デジタルトランスフォーメーション)とビッグデータでグローバル競争力強化を図ります
DX(デジタルトランスフォーメーション)とビッグデータでグローバル競争力強化を図りますExist
 
Anahaw Retail Enterprise Solution
Anahaw Retail Enterprise SolutionAnahaw Retail Enterprise Solution
Anahaw Retail Enterprise SolutionExist
 
Understanding the state of your web application using Apache Kafka, Spark
Understanding the state of your web application using Apache Kafka, SparkUnderstanding the state of your web application using Apache Kafka, Spark
Understanding the state of your web application using Apache Kafka, SparkExist
 
The Philippines eHealth Strategic Framework and Plan (Updates as of May 23, 2...
The Philippines eHealth Strategic Framework and Plan (Updates as of May 23, 2...The Philippines eHealth Strategic Framework and Plan (Updates as of May 23, 2...
The Philippines eHealth Strategic Framework and Plan (Updates as of May 23, 2...Exist
 
API-Centric Rails Web Apps and Hybrid Mobile App Integration
API-Centric Rails Web Apps and Hybrid Mobile App IntegrationAPI-Centric Rails Web Apps and Hybrid Mobile App Integration
API-Centric Rails Web Apps and Hybrid Mobile App IntegrationExist
 
Clinical Analytics for Improving Health Outcomes
Clinical Analytics for Improving Health OutcomesClinical Analytics for Improving Health Outcomes
Clinical Analytics for Improving Health OutcomesExist
 
Exist Customer Success Stories
Exist Customer Success StoriesExist Customer Success Stories
Exist Customer Success StoriesExist
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js PresentationExist
 
Selenium RC Using Java and Maven + Maestro Integration
Selenium RC Using Java and Maven + Maestro IntegrationSelenium RC Using Java and Maven + Maestro Integration
Selenium RC Using Java and Maven + Maestro IntegrationExist
 
Philippine Digital Strategy
Philippine Digital StrategyPhilippine Digital Strategy
Philippine Digital StrategyExist
 
Spectrum of IT BPO Services in the Philippines
Spectrum of IT BPO Services in the PhilippinesSpectrum of IT BPO Services in the Philippines
Spectrum of IT BPO Services in the PhilippinesExist
 
What's new in Drupal 7
What's new in Drupal 7What's new in Drupal 7
What's new in Drupal 7Exist
 
Digital Life
Digital LifeDigital Life
Digital LifeExist
 

Mais de Exist (20)

Postgres Powers Digital Transformation in Southeast Asia – Success Stories
Postgres Powers Digital Transformation in Southeast Asia – Success StoriesPostgres Powers Digital Transformation in Southeast Asia – Success Stories
Postgres Powers Digital Transformation in Southeast Asia – Success Stories
 
Understanding Blockchain and Its Business Benefits
Understanding Blockchain and Its Business BenefitsUnderstanding Blockchain and Its Business Benefits
Understanding Blockchain and Its Business Benefits
 
ブロックチェーンのビジネス上の利点を理解する
ブロックチェーンのビジネス上の利点を理解するブロックチェーンのビジネス上の利点を理解する
ブロックチェーンのビジネス上の利点を理解する
 
How to Select the Right Automation Testing Tool
How to Select the Right Automation Testing ToolHow to Select the Right Automation Testing Tool
How to Select the Right Automation Testing Tool
 
Advancing Global Competitiveness Through Digital Transformation and Big Data ...
Advancing Global Competitiveness Through Digital Transformation and Big Data ...Advancing Global Competitiveness Through Digital Transformation and Big Data ...
Advancing Global Competitiveness Through Digital Transformation and Big Data ...
 
Exist Company Profile
Exist Company ProfileExist Company Profile
Exist Company Profile
 
Exist Company Profile (Nihongo)
Exist Company Profile (Nihongo)Exist Company Profile (Nihongo)
Exist Company Profile (Nihongo)
 
DX(デジタルトランスフォーメーション)とビッグデータでグローバル競争力強化を図ります
DX(デジタルトランスフォーメーション)とビッグデータでグローバル競争力強化を図りますDX(デジタルトランスフォーメーション)とビッグデータでグローバル競争力強化を図ります
DX(デジタルトランスフォーメーション)とビッグデータでグローバル競争力強化を図ります
 
Anahaw Retail Enterprise Solution
Anahaw Retail Enterprise SolutionAnahaw Retail Enterprise Solution
Anahaw Retail Enterprise Solution
 
Understanding the state of your web application using Apache Kafka, Spark
Understanding the state of your web application using Apache Kafka, SparkUnderstanding the state of your web application using Apache Kafka, Spark
Understanding the state of your web application using Apache Kafka, Spark
 
The Philippines eHealth Strategic Framework and Plan (Updates as of May 23, 2...
The Philippines eHealth Strategic Framework and Plan (Updates as of May 23, 2...The Philippines eHealth Strategic Framework and Plan (Updates as of May 23, 2...
The Philippines eHealth Strategic Framework and Plan (Updates as of May 23, 2...
 
API-Centric Rails Web Apps and Hybrid Mobile App Integration
API-Centric Rails Web Apps and Hybrid Mobile App IntegrationAPI-Centric Rails Web Apps and Hybrid Mobile App Integration
API-Centric Rails Web Apps and Hybrid Mobile App Integration
 
Clinical Analytics for Improving Health Outcomes
Clinical Analytics for Improving Health OutcomesClinical Analytics for Improving Health Outcomes
Clinical Analytics for Improving Health Outcomes
 
Exist Customer Success Stories
Exist Customer Success StoriesExist Customer Success Stories
Exist Customer Success Stories
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js Presentation
 
Selenium RC Using Java and Maven + Maestro Integration
Selenium RC Using Java and Maven + Maestro IntegrationSelenium RC Using Java and Maven + Maestro Integration
Selenium RC Using Java and Maven + Maestro Integration
 
Philippine Digital Strategy
Philippine Digital StrategyPhilippine Digital Strategy
Philippine Digital Strategy
 
Spectrum of IT BPO Services in the Philippines
Spectrum of IT BPO Services in the PhilippinesSpectrum of IT BPO Services in the Philippines
Spectrum of IT BPO Services in the Philippines
 
What's new in Drupal 7
What's new in Drupal 7What's new in Drupal 7
What's new in Drupal 7
 
Digital Life
Digital LifeDigital Life
Digital Life
 

Último

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 

Último (20)

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 

Common Pitfalls Experienced in Java

  • 2. 1. Not specifying columns in your select statement (select *)
  • 3. . . StringBuffer queryString = new StringBuffer(); queryString.append("SELECT DISTINCT o.name, o.code, o.price, d.discount “); queryString.append("FROM com.exist.model.Order as o, “); queryString.append("com.exist.model.Discounts as d “); . . . Session session = sessionFactory.getCurrentSession(); Query selectQuery = session.createQuery(queryString.toString()); List<Order> orders= selectQuery.list(); . . . List<OrderTo> orderTo = new ArrayList<OrderTo>(); ... for(Order order:orders){ OrderTo oto = new OrderTo oto.setName(order.getName()); . . . orderTo.add(oto); } . . . 2. Select and Transfer
  • 4. . . . StringBuffer queryString = new StringBuffer(); queryString.append("SELECT DISTINCT new com.exist.to.OrdersTO "); queryString.append("(o.name, o.code, o.price, d.discount) "); queryString.append("FROM com.exist.model.Orders as o, "); queryString.append("com.exist.model.Discounts as d “); . . . Session session = sessionFactory.getCurrentSession(); Query selectQuery = session.createQuery(queryString.toString()); . . . List<OrdersTO> data = selectQuery.list();
  • 5. 3. Not delegating computations . . . double bills = someService.getBills(referenceNo); double payments = someService.getPayments(referenceNo) double due = bills - payments; . . .
  • 6. public class Computations { private SomeService someService; private double bills; private double payments; private double due; public Computations(SomeService someService, String reference) { bills = someService.getBills(referenceNo); payments = someService.getPayments(referenceNo) due = bills - payments; } ... <getters of bills, payments and due> }
  • 7. . . . Computations computations = new Computations(someService, referenceNo); double bills = computations.getBills(); double payments = computations.getPayments(); double due = computations.getDue(); . . .
  • 8. 4. equals String literal variable.equals(“String Literal”);
  • 10. 5. Computing using double or Double double minuend = 1.1d; double subtrahend = 1.0d; double difference = minuend – subtrahend; Or Double minuend = 1.1d; Double subtrahend = 1.0d; Double difference = minuend.doubleValue() – subtrahend.doubleValue();
  • 11. BigDecimal minuend = new BigDecimal(1.1).setScale(2, RoundingMode.HALF_EVEN); BigDecimal subtrahend = 1.0d; BigDecimal difference = minuend.subtract(subtrahend);
  • 12. 6. using objects in if If (object.getBooleanProperty()) { ... }
  • 13. if (object!=null && object.getBooleanProperty()) { ... } Or if (object!=null && object.getNumericProperty()>0) { ... }