Solved

write sql by ExpressionBuilder

Posted on 2006-11-21
6
254 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
  • 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
topping2 challenge 13 91
simple java question 3 56
split string containing \r\n in Java 46 44
Why my table column Id is not passed to java object? 4 39
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.

770 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