need help in findByPrimaryKey


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: need help in findByPrimaryKey

  1. #1
    Join Date
    Jun 2005
    Posts
    15

    need help in findByPrimaryKey

    Hi,
    i have a problem
    when ever i try to map 1:1 relationship at that time when at client side when i call the primary key of other table then the following error occurs
    :-
    non-static method findByPrimaryKey(java.lang.String) cannot be referenced from a static context

    now can any one tell me why this occurs
    i shall be thankful to you

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    This is not a "mapping" issue - it is a coding issue.

    The error message is telling you that the method you are trying to call must be called by and within an instance of the class, rather than from the "class" itself. A static method can be called from "the class" - like many Math class methods, such as calling Math.pow( 2.3, 4.0). A non-static method must be called from an instance of a class - such as myString.toUpperCase( littlestring ).

    The method you are calling is non-static, and you are trying to invoke it by calling Class.method rather than instanceOfClass.method.

Similar Threads

  1. possible to overloard the findByPrimaryKey method?
    By Jared Dinerstein in forum Java
    Replies: 1
    Last Post: 08-29-2002, 02:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center