-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Join Multiple table without making new model...
PostPosted: Sat Mar 17, 2012 1:57 pm 
Newbie

Joined: Thu Mar 15, 2012 2:48 pm
Posts: 13
Hello there, i'm using hibernate, from the company sample, every one busy so they cant answer me, also newly it's 14 day vacation... though i'm still working, i cant see any one to take help from...

the problem i have , is to join multiple data, i'm not much familiar to Hibernate, and using old data model from last system...
the problem i facing, is if i do catch data, and start joining 2 table inside my java classes, the speed will decrease to much that it take several minutes just for one single process...

i wanna join my data model and if is possible, recieve only list of objects...

Also i prefer to use:
class ... extents HibernateDaoSupport
...
HibernateTemplate hibernateTemplate = getHibernateTemplate();

because all my old model are based on that, but the look i had over internet network, there are many ways to do this, but i'm more familar with this one, and i already done providing my bean files, i dont wanna define beans for repeatedly models again...

also i dont wanna move to new Hibernate type of definition, becasue i already done half of the projects...

i also saw some days ago, that user used session to get list of objects, but if using hibernate template its not possible, any other answer will help me...

Thank you
for your attention, precious time and your patient.


Top
 Profile  
 
 Post subject: Re: Join Multiple table without making new model...
PostPosted: Sun Mar 18, 2012 10:34 am 
Newbie

Joined: Thu Mar 15, 2012 2:48 pm
Posts: 13
my models are :

Code:
package com.bedkaco.portlets.teacher.model;
// Generated Oct 11, 2010 4:28:33 PM by Hibernate Tools 3.2.4.GA

import javax.persistence.*;

/**
* SPRStudent generated by hbm2java
*/
@Entity
@Table(name = "teacher", schema = "public")
public class Teacher implements java.io.Serializable {

   private long teachid;
   private String fistname;
   private String lastname;
   private String rate;

   public Teacher() {
   }

   @Id
   @Column(name = "teachid", unique = true, nullable = false)
    public long getTeachid() {
        return teachid;
    }

    public void setTeachid(long teachid) {
        this.teachid = teachid;
    }

    @Column(name = "firstname", length = 150)
   public String getFistname() {
        return fistname;
    }

    public void setFistname(String fistname) {
        this.fistname = fistname;
    }

    @Column(name = "lastname", length = 150)
    public String getLastname() {
        return lastname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    @Column(name = "rate", length = 150)
    public String getRate() {
        return rate;
    }

    public void setRate(String rate) {
        this.rate = rate;
    }
}


AND

Code:
package com.bedkaco.portlets.user_account.model;
// Generated Oct 17, 2010 11:34:51 AM by Hibernate Tools 3.2.4.GA

import com.bedkaco.portlets.group.model.Group;
import com.bedkaco.portlets.major.model.Major;
import com.bedkaco.portlets.system_log.model.SystemLog;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

/**
* UserAccount generated by hbm2java
*/
@Entity
@Table(name = "user_account", schema = "public", uniqueConstraints = @UniqueConstraint(columnNames = "username"))
public class UserAccount implements java.io.Serializable {
    private long id;
   private Group group;
   private Major major;
   private String address;
   private String codemeli;
   private String email;
   private int enabled;
   private String fathername;
   private String firstname;
   private String lastname;
   private String mobile;
   private String passwordHash;
   private String phone;
   private String post;
   private String roleid;
   private String sex;
   private Long stno;
   private String username;

    private List<SystemLog> systemLogs = new ArrayList<SystemLog>(0);

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "userAccount")
   public List<SystemLog> getSystemLogs() {
        return systemLogs;
    }

    public void setSystemLogs(List<SystemLog> systemLogs) {
        this.systemLogs = systemLogs;
    }

    public UserAccount() {
   }

   public UserAccount(long id, int enabled, String firstname, String lastname,
         String username) {
      this.id = id;
      this.enabled = enabled;
      this.firstname = firstname;
      this.lastname = lastname;
      this.username = username;
   }
   public UserAccount(long id, Group group, Major major, String address,
         String codemeli, String email, int enabled, String fathername,
         String firstname, String lastname, String mobile,
         String passwordHash, String phone, String post, String roleid,
         String sex, Long stno, String username) {
      this.id = id;
      this.group = group;
      this.major = major;
      this.address = address;
      this.codemeli = codemeli;
      this.email = email;
      this.enabled = enabled;
      this.fathername = fathername;
      this.firstname = firstname;
      this.lastname = lastname;
      this.mobile = mobile;
      this.passwordHash = passwordHash;
      this.phone = phone;
      this.post = post;
      this.roleid = roleid;
      this.sex = sex;
      this.stno = stno;
      this.username = username;
   }

   @Id
   @Column(name = "id", unique = true, nullable = false)
   public long getId() {
      return this.id;
   }

   public void setId(long id) {
      this.id = id;
   }

   @ManyToOne(fetch = FetchType.LAZY)
   @JoinColumn(name = "groupcode")
   public Group getGroup() {
      return this.group;
   }

   public void setGroup(Group group) {
      this.group = group;
   }

   @ManyToOne(fetch = FetchType.LAZY)
   @JoinColumn(name = "reshtecode")
   public Major getMajor() {
      return this.major;
   }

   public void setMajor(Major major) {
      this.major = major;
   }

   @Column(name = "address", length = 250)
   @Length(max = 250)
   public String getAddress() {
      return this.address;
   }

   public void setAddress(String address) {
      this.address = address;
   }

   @Column(name = "codemeli", length = 50)
   @Length(max = 50)
   public String getCodemeli() {
      return this.codemeli;
   }

   public void setCodemeli(String codemeli) {
      this.codemeli = codemeli;
   }

   @Column(name = "email", length = 1000)
   @Length(max = 100)
   public String getEmail() {
      return this.email;
   }

   public void setEmail(String email) {
      this.email = email;
   }

   @Column(name = "enabled", nullable = false)
   public int getEnabled() {
      return this.enabled;
   }

   public void setEnabled(int enabled) {
      this.enabled = enabled;
   }

   @Column(name = "fathername", length = 50)
   @Length(max = 50)
   public String getFathername() {
      return this.fathername;
   }

   public void setFathername(String fathername) {
      this.fathername = fathername;
   }

   @Column(name = "firstname", nullable = false, length = 50)
   @NotNull
   @Length(max = 50)
   public String getFirstname() {
      return this.firstname;
   }

   public void setFirstname(String firstname) {
      this.firstname = firstname;
   }

   @Column(name = "lastname", nullable = false, length = 50)
   @NotNull
   @Length(max = 50)
   public String getLastname() {
      return this.lastname;
   }

   public void setLastname(String lastname) {
      this.lastname = lastname;
   }

   @Column(name = "mobile", length = 50)
   @Length(max = 50)
   public String getMobile() {
      return this.mobile;
   }

   public void setMobile(String mobile) {
      this.mobile = mobile;
   }

   @Column(name = "password_hash")
   public String getPasswordHash() {
      return this.passwordHash;
   }

   public void setPasswordHash(String passwordHash) {
      this.passwordHash = passwordHash;
   }

   @Column(name = "phone", length = 50)
   @Length(max = 50)
   public String getPhone() {
      return this.phone;
   }

   public void setPhone(String phone) {
      this.phone = phone;
   }

   @Column(name = "post", length = 1000)
   @Length(max = 100)
   public String getPost() {
      return this.post;
   }

   public void setPost(String post) {
      this.post = post;
   }

   @Column(name = "roleid", length = 50)
   @Length(max = 50)
   public String getRoleid() {
      return this.roleid;
   }

   public void setRoleid(String roleid) {
      this.roleid = roleid;
   }

   @Column(name = "sex")
   public String getSex() {
      return this.sex;
   }

   public void setSex(String sex) {
      this.sex = sex;
   }

   @Column(name = "stno")
   public Long getStno() {
      return this.stno;
   }

   public void setStno(Long stno) {
      this.stno = stno;
   }

   @Column(name = "username", unique = true, nullable = false)
   @NotNull
   public String getUsername() {
      return this.username;
   }

   public void setUsername(String username) {
      this.username = username;
   }

}


please help :| :-s


Top
 Profile  
 
 Post subject: Re: Join Multiple table without making new model...
PostPosted: Wed Mar 21, 2012 8:05 am 
Newbie

Joined: Thu Mar 15, 2012 2:48 pm
Posts: 13
i'm going vacation, i hope to see the answer till then i back


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.