retrieving query data

Ads
 

retrieving query data

Blockquote

I am new to java or hibernate...

Trying to get data from database...it does not pick up the data...

Authentication.java

public List<String> domains()

{   
    Query query = sessionFactory.getCurrentSession().createQuery(

"select distinct domainName from User");

    List <String> domains = query.list();   
    return domains;   

}

Gatekeeper.java

public Domain getdomain()

{   

    logger.error("Starting getDomain()");   

    AuthenticationService auth = AppContext.getBean("auth");   

    Domain domainlist = new Domain();   

    domainlist.setDom(auth.domains());   
    return domainlist;     

}

Domain.java

public class Domain {

protected List<String> dom;   

public List<String> getDom() {   
    return dom;   
}   

public void setDom(List<String> dom) {   
    this.dom = dom;   
}   

@Override  
public String toString() {   
    return "Domain [dom=" + dom + "]";   
}   

    }

Main.Class

Gatekeeper gateKeeper = new GatekeeperService().getGatekeeperPort(); Domain list = new Domain();
list = gateKeeper.getDomain();
System.out.println("The domain is " + list);

It gives null values even though the User table has data

View Answers

July 29, 2011 at 10:16 AM

Please go through the following link:

Java Hibernate Tutorials

Ads









Related Tutorials/Questions & Answers:
retrieving query data
retrieving query data   Blockquote I am new to java or hibernate... Trying to get data from database...it does not pick up the data... Authentication.java public List<String> domains() { Query query
Retrieving specific data from excel
Retrieving specific data from excel  Hello everyone, i have written a simple code to retrieve data from excel sheet and working fine, the excel file contain heading for each row written in bold and the student details
Advertisements
Retrieving XML Data Using GWT
Retrieving XML Data Using GWT       This Example Describes the way of retrieving XML file Data from the server using GWT. The basic building block for running this example which we
single query to insert the data
single query to insert the data  How to insert data for all HTML fields in single MYSQL query
Retrieving Data from Database to fill Combo Box
Retrieving Data from Database to fill Combo Box  Sir, I have a JSP Page with a combo box and a label. I have a database that has two fields id and an image. Now I want to fill the combo box with image and on selecting
retrieving excel data when file uploading
retrieving excel data when file uploading  <%@page import...); } } %> when i gave full path name i got excel data but when file uploading not getting the excel data
how to check dates while retrieving data from database
how to check dates while retrieving data from database  i want to update database record based on delivery date i have tried this query but it wont work b="update deliveryorder set prtnm='"+arr[1]+"',stn='"+arr[0]+"',sbston
Retrieving data from data base using jsp combo box
Retrieving data from data base using jsp combo box  Hi guys please help me , i have on GUI page int that Server type(like apache,jboss,weblogic) one combo box is there and another filed is version of the server(like 1.0,2.0) like
Jdbc connectivity in java to oracle for retrieving data between two dates
Jdbc connectivity in java to oracle for retrieving data between two dates  Dear Sir, I Need a program in which i want to retrieve the data b/w two... is arise when i get date from data base in the format such as 10/04/2012 00:00:00
Storing and retrieving data alongwith image in mysql db using jsp
Storing and retrieving data alongwith image in mysql db using jsp  I want to store and retrieve the whole data as shown below in mysql db. I've put... | | | file_data | longblob | YES | | NULL
retrieving of data from one jsp to another jsp - JSP-Servlet
retrieving of data from one jsp to another jsp  using jsp i m displaying a table ,in table i m displaying a radio button then values like id,name etc ,if i click on an radio button i have to get a corresponding id value
The code for retrieving data from database into Drop Down List.
The code for retrieving data from database into Drop Down List.  <% DataSource data = new MysqlDataSource(); Connection con = data.getConnection("root","system"); System.out.println("Connected
retrieving data from database to the textbox depending upon the id in jsp
retrieving data from database to the textbox depending upon the id in jsp  Hi, our project involves fetching of data from database into textbox... data =""; try{ Class.forName("com.mysql.jdbc.Driver
retrieving data in to the dropdown box from postgresql database in core java
retrieving data in to the dropdown box from postgresql database in core java  hi., i just need to correct my codes.somebody help me to clear the error to bring a right of codes to execute.Thanks in advance. //first page
how to make a radiobutton selected when retrieving data from database using struts framework and spring jdbc
how to make a radiobutton selected when retrieving data from database using struts framework and spring jdbc  how to make a radio button selected when retrieving data from database using struts framework and spring jdbc
Struts validation for j-query tabs data
Struts validation for j-query tabs data  Hi, I want apply struts validation for J-query tabs data while saving into database, can any body tell please
Retrieving JTree structure from database
Retrieving JTree structure from database       This example shows how to retrieving data from... the steps required to create tree retrieving the data from the database. Here
How to use sum sql query to process the summed data into a list?
How to use sum sql query to process the summed data into a list?  Im get stuck to get sum of data in database. Then i need to list the summed of data in jsp page. For example, i have a database named family that store
How to use sum sql query to process the summed data into a list?
How to use sum sql query to process the summed data into a list?  Im get stuck to get sum of data in database. Then i need to list the summed of data in jsp page. For example, i have a database named family that store
Retrieving Data from the table using PreparedStatement
Retrieving Data from the table using PreparedStatement... to fetch the data from the database in the table from our java program using...() method of the PrintWriter class. We can retrieve the data from the database only
Retrieving Data from the table using Statement
Retrieving Data from the table using Statement  ... to retrieve the data from the table so we need to write a query to select all... to fetch the data from the database in the table from our java program.  
query
query  how to get data from database in tables using swings
Hibernate Update Query
by retrieving data from the underlying database using the hibernate. Lets first... Hibernate Update Query      ... a row of the insurance table. Here is the code of delete query
Connecting to MySQL database and retrieving and displaying data in JSP page
Retrieving list of uploaded files.
Retrieving list of uploaded files.  I need to retrieve list of files uploaded by all user's and display it on the webpage. Example: I uploaded 3 files on a website. its uploaded. now the file resides in a directory in the server
Examples of Hibernate Criteria Query
the database for adding, retrieving, updating and deleting the data stored...Example code and running projects of Hibernate Criteria Query Here are examples of Criteria Query in Hibernate and all the examples comes with the running
Retrieving value from multiple table in database
Retrieving value from multiple table in database  Hi fnds, I want... contains the data like name,amount,paiddate and balance of individual users... i... urgent frnds...   Use the given query SELECT uname, SUM(balance) as sm
retrieving from db - JSP-Servlet
retrieving from db  hello' I am trying to write my first application connecting to the database. I have found some code but i am getting...; Hi Retrive value from database Retrive data from
retrieving xml document from database
retrieving xml document from database  Hi Guys, I want to retrieve the xml document stored in the database on to a jsp page using jdbc/odbc connnection.Please help me in implementing this feature. Thank You Madhu
Retrieving a Preference Node
Retrieving a Preference Node       This section demonstrates you to retrieve a Preference node. You can see in the given example that we have used an absolute path in order to get
Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same
Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same  Hello , My query got solved. Thnx.I am right now going to save the marathi data into mysql and trying to retrieving the same from

Ads