Solved

write sql by ExpressionBuilder

Posted on 2006-11-21
6
270 Views
Last Modified: 2010-03-31
hi experts,

     -I wanna perform a select task in toplink (an ORM framework of oracle) using ExpressionBuilder
              but i don't know how to write this sql statement in ExpressionBuilder syntax.  

  here is my sql syntax :
                                "select * from "Information" where ("LastName" || "MiddleName" || "FirstName") = 'MrJohnSmith' " 

 please help me how to write this

 thanks so much
 lubuPhan


0
Comment
Question by:trkg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17993951
try this:



ExpressionBuilder builder = new ExpressionBuilder();
Expression expression = builder.get("LastName").equal("MrJohnSmith").or(builder.get("MiddleName").equal("MrJohnSmith")).or(builder.get("FirstName").equal("MrJohnSmith"));

Vector list = uow.readAllObjects(Information.class, expression);
0
 

Author Comment

by:trkg
ID: 17994714
oh sorry sir !  

my Table         Information                  

         column                    LastName        MiddleName      FirstName  
row1                                     Mr                    John              Smith
row2                                    Mrs                  Jonh              Smith


my sql syntax
        "select * from "Information" where ("LastName" || "MiddleName" || "FirstName") = 'MrJohnSmith' " 

and my result  is  row1

sry bc my english 's too bad....  

0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17994730
In that case it would be


ExpressionBuilder builder = new ExpressionBuilder();
Expression expression = builder.get("LastName").equal("Mr").and(builder.get("MiddleName").equal("John")).and(builder.get("FirstName").equal("Smith"));

Vector list = uow.readAllObjects(Information.class, expression);
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:trkg
ID: 17994770
ok , but i don't want to cut String MrJohnSmith  ,  i want to add 3 column  then equal that with String .

the same my sql.  i add 3 column   ("LastName" || "MiddleName" || "FirstName")   then  equal  with  "MrJohnSmith"

thanks sir very much about your answers.  
0
 
LVL 23

Accepted Solution

by:
Ajay-Singh earned 500 total points
ID: 17994901
I believe both are same
0
 

Author Comment

by:trkg
ID: 17995234
yes , i know both are same result , but i NEED to that in my way .

thanks very much
0

Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Certificat to iSeries KeyStore 1 30
SHA2 certs for IIS AND Java? 2 136
difference between sorce folder and folder in eclipise 3 64
Running JavaFX on the Raspberry Pi 27 290
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question