Hi guys ,

İ have a hibernate problem again, here's my problem ,
I have an exam schedule table in my database and i inserted 3 rows of
data in this table. But when i try to get the data from database using
hibernate, just the first data comes. i mean , if there are 3 rows in
the table , so the FIRST ROW returns 3 times!. please help to fix this
issue.

here's my code ;


SinavTakvim.java
***********************
//ExamSchedule domain class


package tr.edu.gsu.yds.shared.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import net.sf.gilead.pojo.gwt.LightEntity;

//ExamSchedule Domain

@Entity
@Table(name = "sinavtakvim")
public class SinavTakvim extends LightEntity implements Serializable
{
        private static final long serialVersionUID = 1L;

        private Integer sinavTakvimId;
        private String sinavTarih;
        private String sinavSinif;
        private String sinavNot;

        @Id
        @Column(name = "sinavTakvimId", nullable = false, length=10)
        public Integer getSinavTakvimId()
        {
                return sinavTakvimId;
        }

        public void setSinavTakvimId( Integer sinavTakvimId )
        {
                this.sinavTakvimId = sinavTakvimId;
        }

        @Column(name = "sinavTarihi", nullable = false, length=20)
        public String getSinavTarihi()
        {
                return sinavTarih;
        }

        public void setSinavTarihi( String sinavTarihi )
        {
                this.sinavTarih = sinavTarihi;
        }

        @Column(name = "sinavSinif", nullable = false, length=45)
        public String getSinavSinif()
        {
                return sinavSinif;
        }

        public void setSinavSinif( String sinavSinif )
        {
                this.sinavSinif = sinavSinif;
        }

        @Column(name = "sinavNot", length=45)
        public String getSinavNot()
        {
                return sinavNot;
        }

        public void setSinavNot( String sinavNot )
        {
                this.sinavNot = sinavNot;
        }

}

-------------------------------------------------------------




SinavTakvimDao.java
************************************
package tr.edu.gsu.yds.server.dao;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import tr.edu.gsu.yds.server.util.GileadHibernateUtil;
import tr.edu.gsu.yds.shared.domain.SinavTakvim;

//ExamSchedule DAO

public class SinavTakvimDao
{
        public List<SinavTakvim> getSinavTakvimList()
        {
                Session session = null;
                Transaction transaction = null;
                try
                {
                        session = 
GileadHibernateUtil.getSessionFactory().openSession();
                        transaction = session.beginTransaction();
                        List<SinavTakvim> sinavTakvimList = 
session.createQuery("from
SinavTakvim").list();
                        transaction.commit();
                        return sinavTakvimList;
                }
                catch ( RuntimeException e )
                {
                        transaction.rollback();
                        throw e;
                }
                finally
                {
                        if ( session != null )
                        {
                                session.close();
                        }
                }
        }


}

-------------------------------------------------------------




Here's i get the data from database and put the data into a celltable
*****************************************


package tr.edu.gsu.yds.client.controller.ogrenci;

import java.util.List;

import tr.edu.gsu.yds.client.remote.YdsRemoteService;
import tr.edu.gsu.yds.client.remote.YdsRemoteServiceAsync;
import
tr.edu.gsu.yds.client.view.ogrenci.sinavislemleri.SinavTarihiGoruntuleme;
import tr.edu.gsu.yds.shared.domain.SinavTakvim;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class OgrenciSinavTarihiGoruntulemeController
{
        private YdsRemoteServiceAsync ydsRemoteServiceAsync =
GWT.create( YdsRemoteService.class );
        private SinavTarihiGoruntuleme ogrenciSinavTarihiGoruntulemeSayfasi;




        public
OgrenciSinavTarihiGoruntulemeController( SinavTarihiGoruntuleme
ogrenciSinavTarihiGoruntulemeSayfasi )
        {
                this.ogrenciSinavTarihiGoruntulemeSayfasi =
ogrenciSinavTarihiGoruntulemeSayfasi;

        }

        public void send()
        {


                ydsRemoteServiceAsync.getSinavTakvimList( new
AsyncCallback<List<SinavTakvim>>()
                                {
                                        public void onFailure( Throwable caught 
)
                                        {
                                                        Window.alert("Failure 
Error");
                                        }

                                       //Just Here , result returns
the "first row" 3 times , instead of all the 3 different rows.
                                        public void onSuccess( 
List<SinavTakvim> result )
                                        {

                                                if( result != null )
                                                        {

                                                        //Put the data
in to a celltable
        
ogrenciSinavTarihiGoruntulemeSayfasi.getSinavTakvimCell().refresh( result );

                                                        }
                                                else
                                                        {
                                                        Window.alert( " No exam 
found! " );

                                                        }
                                                }

                                        } );



        
ogrenciSinavTarihiGoruntulemeSayfasi.getOkeyButton().addClickHandler( new
ClickHandler()
                {

                        @Override
                        public void onClick( ClickEvent event )
                        {
                                String date =
ogrenciSinavTarihiGoruntulemeSayfasi.getSinavTarihWidget().getSelectedDate().toString();
                                Window.alert( date );

                        }
                } );


        }

}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to