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 = 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









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
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
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 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
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
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
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
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
Connecting to MySQL database and retrieving and displaying data in JSP page
Connecting to MySQL database and retrieving and displaying data in JSP page...; This tutorial shows you how to connect to MySQL database and retrieve the data..._TO_REPLACE_3 Executing Query and Processing result set In this example we will use
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
sql query to get data from two tables
sql query to get data from two tables  how can i get the data from two different tables?   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 JOIN Query Simple Query ThanksADS_TO_REPLACE_2
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 database and how to add the data in to JTree. JTree : JTree is used
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... the getWriter() method of the PrintWriter class. We can retrieve the data from
Retrieving Data from the table using Statement
Retrieving Data from the table using Statement  ... by it. As we need to retrieve the data from the table so we need to write a query... to fetch the data from the database in the table from our java program.  
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
Hibernate Update Query
by retrieving data from the underlying database using the hibernate. Lets first... Hibernate Update Query      ... a row of the insurance table.ADS_TO_REPLACE_1 Here is the code of delete query
query
query  how to get data from database in tables using swings
Data Service and Query Builder Tool
Data Service and Query Builder Tool       Data Service is more than data manager or data organization, it is data service perspective. It will be able to manage
Connecting to MySQL database and retrieving and displaying data in JSP page
Retrieving cells in MySQL - JDBC
Retrieving cells in MySQL  Hi, Am creating an online exam application using JSP & MySql.The exam is of objective nature with four choices each and 100 questions. Can you please help me to insert the chosen choice into cells
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
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 image files - JSP-Servlet
retrieving image files  How to retrieve multiple images at a time from mysql database using JSP
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 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
Retrieving the Image from a database Table
.  After the connection establishment we will pass a query for retrieving...Retrieving the Image from a database Table Consider a case where we want that along with the name of the person and its information, his image should also
Retrieving attribute value from XML
Retrieving attribute value from XML  I have an XML as below to parse: <LoadTicketRequest> <LoadTicket LoadTicketID="S-123345"> ..... But am not able to fetch the value of LoadTicketId attribute. My code
graph generation using jfreechart and retrieving values from the database
graph generation using jfreechart and retrieving values from the database ... no. of students.The dsn name is chartdsn. I want to retrieve the data from the access...", "sun.jdbc.odbc.JdbcOdbcDriver","root","root"); what is student here and how the data is being
related retrieving value from oracle database
related retrieving value from oracle database  how we get the value from database in the given textbox
related retrieving value from oracle database
related retrieving value from oracle database  how we get the value from database in the given textbox
sql query - JDBC
sql query  I need a SQL query to add data into database
retrieving info from DB using struts?
retrieving info from DB using struts?  Hi. I was looking info about retrieving info from a database using struts. I need a .java that I suppose connects to a database and show the info on a jsp. Somebody could help me
check radio button on retrieving the value from database.
check radio button on retrieving the value from database.  HI i am new to jsp.In my applcation i having a problem. I am retrieving user payment from... checked.If user has done payment through cash then when i am retrieving user
retrieving of value from excel file - JSP-Servlet
retrieving of value from excel file  Dear sir, Thanks for sending a code now i am getting a particular column values i.e EmailId column for sending... this message to all the employees when i upload a file then it fetch a data from
retrieving of value from excel file - JSP-Servlet
retrieving of value from excel file  Dear sir, Thanks for sending a code now i am getting a particular column values i.e EmailId column for sending... this message to all the employees when i upload a file then it fetch a data from
Hibernate Query Checker
Hibernate Query Checker  How in Hibernate. We can control that programmer should not make query which hang the system. Like table having more the 20 million of data. Query must have where clause
Retrieving Data From the XML file
Retrieving Data From the XML file  ....  By this example we are going to get the XML data from the xml file in our jsp file. We have a XML file in which we have some data. What we need
jtable query compare with date
jtable query compare with date  how to transfer daytable data to monthtable when complete a month

Ads