• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate POJO class grtter method

 
Hemakanta Sethi
Greenhorn
Posts: 17
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

In Hibernate I have a POJO class(Employee), contain employeeId.
we generally create getter method as getEmployeeId.

public class MyEmployee
{
private String employeeId;
public String getEmployeeId(){
return employeeId;
}
public void setEMployeeId(String employeeId){
this.employeeId = employeeId;
}
}

/////////////////////////////////////////////

In th e above code can i declare
public static String getEmployeeId(){
return employeeId;
}

if No then why?
 
Vijitha Kumara
Bartender
Posts: 3954
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you want to do that in the first place? Shouldn't the Id be unique to each instance?
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!