Solved

write sql by ExpressionBuilder

Posted on 2006-11-21
6
260 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
oracle 11g 23 106
varialbe initialization 11 37
Configure a Bean in an XML file 4 42
jboss 7.1 start up error 1 30
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

809 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