• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

findByPrimaryKey( ... )  RSS feed

 
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
 
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!