I want is that I get  user name!

Hi,
Below are my two annotated classes, namely, Requisition and User, that represent two tables requisitions and users. What I want is that I get
to get username from users table in my requisition query instead of user id which is stored in the requisitions.request_by.
Table field requisitions.request_by hold the ids of users ,ie, users.id values.
Here are my tables:
     users
               + id int(11)
               username varchar(15)
               password varchar(15)
               role int(11)
               last_login timestamp
     requisitions
               id int(11)
               post varchar(50)
               + request_by int(11)
               platform varchar(50)
               experience_required int(11)
               comments text
               date_requested date
Here is my Query for fetching requsition object in the RequisitionServiceimpl.java
     public List getRequisitions(User loggedInUser){
          Query queryRequsitions = em.createQuery("Select r FROM Requisition as r");
          List list = queryRequsitions.getResultList();          
          return list;     
Below are my two annotated classes Requisition and User:
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SecondaryTable;
import javax.persistence.Table;
import javax.persistence.JoinColumns;
import javax.persistence.JoinColumn;
@Table(name="requisitions")
@SecondaryTable(name="users")
@Entity
public class Requisition {
     @Id
     private int id;
     private String post;
     @Column(name = "request_by")
     private int requestBy;
     private String platform;
     @Column(name = "experience_required")
     private int experienceRequired;
     private String comments;
     @Column(name = "date_requested")
     private Date dateRequested;
     // Name from users Table
     @Column(table="users", name="username")
     private String username;
     public int getId() {
          return id;
     public void setId(int id) {
          this.id = id;
     public String getPost() {
          return post;
     public void setPost(String post) {
          this.post = post;
     public int getRequestBy() {
          return requestBy;
     public void setRequestBy(int requestBy) {
          this.requestBy = requestBy;
     public String getPlatform() {
          return platform;
     public void setPlatform(String platform) {
          this.platform = platform;
     public int getExperienceRequired() {
          return experienceRequired;
     public void setExperienceRequired(int experienceRequired) {
          this.experienceRequired = experienceRequired;
     public String getComments() {
          return comments;
     public void setComments(String comments) {
          this.comments = comments;
     public Date getDateRequested() {
          return dateRequested;
     public void setDateRequested(Date dateRequested) {
          this.dateRequested = dateRequested;
// Only Getter for Users Table field username
     public String getUsername() {
          return username;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Table(name="users")
@Entity
public class User {
@Id
private Long id;
@Column(name="username")
private String name;
private String password;
private int role;
public String getName() {
return name;
public void setName(String user) {
this.name = user;
public String getPassword() {
return password;
public void setPassword(String password) {
this.password = password;
public Long getId() {
return id;
public void setId(Long id) {
this.id = id;
public int getRole() {
return role;
public void setRole(int role){
this.role = role;
Thank you,
Adil

I made this changes to Requisition.java and now I can get user name
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Table(name="requisitions")
@Entity
public class Requisition {
@Id
private int id;
private String post;
@Column(name = "request_by")
private int requestBy;
private String platform;
@Column(name = "experience_required")
private int experienceRequired;
private String comments;
@Column(name = "date_requested")
private Date dateRequested;
@OneToOne
@JoinColumn( name="request_by", insertable=false, updatable=false)
private User user;
public int getId() {
return id;
public void setId(int id) {
this.id = id;
public String getPost() {
return post;
public void setPost(String post) {
this.post = post;
public int getRequestBy() {
return requestBy;
public void setRequestBy(int requestBy) {
this.requestBy = requestBy;
public String getPlatform() {
return platform;
public void setPlatform(String platform) {
this.platform = platform;
public int getExperienceRequired() {
return experienceRequired;
public void setExperienceRequired(int experienceRequired) {
this.experienceRequired = experienceRequired;
public String getComments() {
return comments;
public void setComments(String comments) {
this.comments = comments;
public Date getDateRequested() {
return dateRequested;
public void setDateRequested(Date dateRequested) {
this.dateRequested = dateRequested;
public User getUser() {
return user;
public void setUser(User user) {
this.user = user;
Edited by: adilsun on Jul 23, 2008 8:36 PM

Similar Messages

  • HT4436 why do i keep getting a message that states "the user name or password for "icloud" is incorrect?

    Why do I keep getting a message that states "the user name or password for icloud is incorrect.

    Apple are currently trying to get less secure passwords updated. They require that your account passwords are at least eight characters long and contain both alpha and numeric characters and at least one upper case alpha character.
    You might try changing your account password to match these requirements.
    My Apple ID

  • I can't sign into Firefox Sync on my Android phone, but I can sign in on the computer. On the mobile device it says that the password/user name is wrong.

    I am unable to sign into Firefox Sync on my Samsung Galaxy S4, using the exact same password and user name that I successfully sign in on the desktop computer. On the mobile device, I get a message stating that either the user name or password is incorrect. I want to be able to sync Firefox on the computer with Firefox on the phone, especially for the bookmarks, but I'm unable to do so even following the directions in the How-To video.

    Hi pitbulllady
    I would suggest a) resetting the password on desktop https://support.mozilla.org/en-US/kb/ive-lost-my-firefox-sync-account-information#w_iaove-forgotten-my-sync-password-ae-how-do-i-reset-it_2 and then b) trying again on your Android phone or tablet
    If the above doesn't help and since we can't read minds :-) we need more troubleshooting details to help you:
    # What version of Android are you using (e.g. Jellybean 4.1-4.3, Kitkat 4.4, Lollipop 5.0, 5.1, etc)?
    # What version of Firefox for Android are you using? (please try the latest version which is currently FF37.0.1)
    # What did you do exactly, what happened and what did you expect? (details please! including the steps in the video you followed)
    Cheers!
    ...Roland

  • BAPI to get user name

    Hi ,
    Is there any BAPI to get the user name while importing employee number ?
    input parameter : employee number
    output parameter : user name
    Regards,
    Pavani
    With a little more effort you would have
    found CATSXT_GET_USER_ID_OF_PERNR in
    your system
    Edited by: Suresh Datti on Sep 1, 2009 2:42 PM

    For this  BAPI_USER_GET_DETAIL   input parameter is user name .i want to pass employee number and get user name .
    i am looking for BAPI not normal functional modules.if there are any BAPIs pls send .
    Regards,
    Pavani

  • I have just made my apple ID and every time I use it to sign into iChat, it says that either my user name or password is incorrect.

    I have just made my apple ID and every time I use it to sign into iChat, it says that either my user name or password is incorrect. Does anyone know how to fix this?

    Hello, did you create it here?
    https://appleid.apple.com/cgi-bin/WebObjects/MyInfo.woa/wa/createAppleId?createa cctype=lite&userid=dmac&localang=en_US
    https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/
    You can also get a free AIM account that works for iChat...
    http://answers.yahoo.com/question/index?qid=20081115091707AAwdJzf
    https://new.aol.com/productsweb/?promocode=825969

  • Getting user name from sopa header

    How should get user name from soap header in my udf...?i searched in sdn,but not get exact solution...

    I din't get this with SRemoteUser
    1. i've enabled " Do Not Use SOAP Envolope"
    2.Enabled ASMA
    3.Variable Transport Binding .
    used the following code as well:
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey user = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/SOAP", "SRemoteUser");
    conf.get(user);
    But not value in it.. Correct me if iam wrong..

  • Firefox gives me an error (SSL protocol has been disabled) when every I go to a site that requires a user name/password; how do I fix it

    Everytime I try to log on to any website that requires a username & password, I receive the following error: SSL protocol has been disabled. I have tried all of the suggested solutions to this issue - but to no avail. I cannot log on to yahoomail. gmail, hotmail, ebay, paypal, or any other site that requires a user name and pass word. Internet Explorer works just fine - and again I have tried all the solutions suggested on the firefox support forum - but none have worked
    == URL of affected sites ==
    http://www.yahoo.com
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.5; InfoPath.2; .NET CLR 1.1.4322)

    Check your settings on Tools > Options > Advanced > Encryption; see: http://support.mozilla.com/en-US/kb/Options+window+-+Advanced+panel#Encryption_tab

  • Get User Names and Mail Ids present in Exchange Server

    Hello All,
    Can we get all the names and mail ids present in the exchange Server global address book?
    I tried one example but it is giving error.
    Exception in thread "main" javax.naming.CommunicationException: [LDAP: error
                code 2 - Protocol Error]; remaining name 's=satheesh'
    Code is given below:
    Hashtable env = new Hashtable(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL, "ldap://mailserver:389");
    DirContext ctx = new InitialDirContext(env);
    Attributes answer = ctx.getAttributes("s=satheesh");
    Any example code to get user names and mail ids will be helpful.
    Thanks in advance.
    Regards,
    Satheesh A
    [email protected]

    Hi Satheesh,
    I am new to LDAP. I am facing the exact same problem as you mentioned. Did you solve your problem?
    Thanks for any help you can provide.
    Hello All,
    Can we get all the names and mail ids present in the
    exchange Server global address book?
    I tried one example but it is giving error.
    Exception in thread "main"
    read "main" javax.naming.CommunicationException:
    [LDAP: error
    code 2 - Protocol Error]; remaining name
    aining name 's=satheesh'
    Code is given below:
    Hashtable env = new Hashtable(11);
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.sun.jndi.ldap.LdapCtxFactory");
    env.put(Context.PROVIDER_URL,
    "ldap://mailserver:389");
    DirContext ctx = new InitialDirContext(env);
    Attributes answer = ctx.getAttributes("s=satheesh");
    Any example code to get user names and mail ids will
    be helpful.
    Thanks in advance.
    Regards,
    Satheesh A
    [email protected]

  • I using new ipad 32gb and i cant get user name and password how i configure it ? please give me solution

    im using new ipad 32gb and i cant get user name and password how i configure it ? please give me solution

    What do you mean 'can't get user name and password' ? What are you trying to do with your iPad and what happens when you do it ?

  • I'm on a web site that requires a user name and password to enter the site., but Firefox has never asked me if I want to save this info. Is it possible to do this even though Firefox never asked me?

    This is the only site that Firefox has not asked me to save user name and password.

    The website may be using autocomplete=off to prevent Firefox from saving the name and password.
    You can remove autocomplete=off with a bookmarklet to make Firefox save the name and password.
    *http://kb.mozillazine.org/User_name_and_password_not_remembered
    See also:
    *Saved Password Editor: https://addons.mozilla.org/firefox/addon/saved-password-editor/

  • HT204053 I changed my internet service provider and no longer have the email that is the user name for my apple id. Is this just anecdotal, or is it going to cause me problems in the future? I no longer receive any of the mail sent to that address.

    At first I thought I had to change the user name on my apple id, but I guess that is not possible.  If I want my apple id to be linked to my current email address which is a gmail, I guess I am basically creating a new apple id, with all the complications that brings, right?
    I have the same issue with my iCloud.
    Should I do anything about this?

    Roger, thank you.  I wish I had sent out this question a month ago, when I committed the folly of creating another apple id with my alternate email address.  Since then, I had realized that I didn't seem to need it, hence today's post.
    So now what do I do?  Is there anyway to delete that unecessary apple id?
    And it is even worse than that...the secondary address listed currently in our apple id is a mobile me one that my husband created, but never uses, never checks, and probably doesn't even remember the password for. 

  • Getting user name (at command line argument)

    At the beginning of my program I need to prompt for the user name and then follow this with a welcoming message. Please help as I have not yet learnt this in my studies!

    When prgramming java, and surely when learning it, alway use the documentation. You ken find it @ http://java.sun.com/j2se/1.3/docs.html To do input and output with the console you need the java.lang.System (Doc are @ http://java.sun.com/j2se/1.3/docs/api/java/lang/System.html ). The system object has an open inputstream called in wich reads the standard input, normally what users type on the console. So System.in.read() will get you a char that is typed on the console.
    In your case it might be easier to create a BufferedReader.
    BufferedReader input = new BufferedReader(System.in); will create a buffered reader that reads from the console. The advantage is that you can now use input.readLine() to read a complete line (until return key is pressed).
    Succes
    AVee

  • Get user name

    Hi I need Labview to programatically create a file in the C:\Documents and Settings\"Username"\Application Data\ folder but i do not not how to find the user name.  I tried the "Get permissions' function but that returned nothing for the owner and group
    My only other choice would be to use the temporary directory filepath and work backwords but that is not very clean
    thanks

    Hey,
    Please open and run attached VI, this should help.
    Christian
    Attachments:
    Username1.vi ‏18 KB

  • How to get User Name?

    Hi Guys,
    I want to retrieve the user names? Can you please tell me in which table SAP stores it?
    My SQL query will be as shown:
    SELECT SINGLE * FROM (TABLE NAME ???) INTO WORK AREA WHERE DBTAB-USERID EQ SYST-UNAME.
    Here I want the database table name where we store the user ID names.
    Thanks,
    Hemal

    Hi TCS Team,
    Please find attached code for your requirement.
    You can also get this from VIEW USSR_ADDR ( Given in one of the reply )
    CLEAR w_usr21.
    SELECT SINGLE *
    FROM usr21
    INTO w_usr21
    WHERE bname = sy-uname.
    CLEAR w_adcp.
    SELECT SINGLE *
    FROM adcp
    INTO w_adcp
    WHERE addrnumber = w_usr21-addrnumber
    AND   persnumber = w_usr21-persnumber.
    CLEAR w_name.
    SELECT SINGLE NAME_TEXT
    FROM adrp
    INTO w_name
    WHERE persnumber = w_usr21-persnumber.
    Thanks,
    Hemal Shah

  • How do I change the setting that remembers which user names are typed within the user name tabs of given websites?

    When I am typing in my user name for a website, a bunch of previously typed user names pop up. I Do not want those other names to pop up, and/or I just want my own user name to appear when I begin to type it.

    When the unwanted name pops up and is highlighted hit the delete key on your keyboard and it will be removed and not pop up again.
    For more details see [[Form autocomplete#w_deleting-individual-form-entries]] Note you can scroll up and down that page
    You may also be interested in looking at [[Location bar autocomplete]]

Maybe you are looking for