• Post Reply Bookmark Topic Watch Topic
  • New Topic

findByPrimaryKey( ... )

 
Ryan P. Kane
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can the findByPrimaryKey method of the Home interface have a primitive as a parameter, or does it require an object? e.g.

public Course findByPrimaryKey(int courseID);

or

public Course findByPrimaryKey(Integer courseID);

Thanks,
Ryan
 
Ankur Srivastava
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the findByPrimaryKey method of the Home interface can have a primitive as a parameter.
 
Ryan P. Kane
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,
I may have left out an important detail though...
Does it make any difference if it is using Container Managed Persistance?

Thanks,
Ryan
 
Ankur Srivastava
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry for not have seen your question properly.

Actually for both Container as well as Bean managed persistence you need to write a Primary Key class YourClassPK which implements Serializable interface.

This class can have primitive datatypes as its fields (they map to the data type of the primary key in your table).

Sorry for having confused you.

---
Ankur
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!