facebook

wrong method signature: Hibernate vs MyEclipse

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #265492 Reply

    pierdeux
    Member

    I am trying to apply the addEntity(Class entityClass) to an org.hibernate.SQLQuery object. With that specific signature, the addEntity method is meant to refer to all the columns returned by the SELECT statement (casting them into the Entity, no questions asked). However, Eclipse interprets my attempts as referring to the addEntity(String, String) version of the method. The error message reads: The method addEntity(String, String) in the type SQLQuery is not applicable for the arguments (Class<MyClass>)

    And here is the complete list of addEntity methods, as suggested by Eclipse:
    addEntity(String, Class)
    addEntity(String, String)
    addEntity(String, Class, LockMode)
    addEntity(String, String, LockMode)
    addEntity(String, String, boolean, LockMode)

    Compare that with the list of addEntity methods from the Hibernate 3 API; it is quite different: http://www.hibernate.org/hib_docs/v3/api/org/hibernate/SQLQuery.html

    After I encountered this error, I made sure to add my own hibernate3.jar (from Hibernate 3.2) to the Preference > MyEclipse > ProjectCapabilities > Hibernate > Hibernate3.1. But that made no difference.

    Am I missing a setup somewhere that would entice MyEclipse to refer to an up-to-date version of the API?

    System properties: OS=WindowsXP, OS version=5.1, Java version=1.5.0_06
    MyEclipse details: MyEclipse Enterprise Workbench, Version: 5.1.0 GA, Build id: 20061111-5.1.0-GA
    Eclipse details: MyEclipse Enterprise Workbench, Version: 5.1.0 GA, Build id: 20061111-5.1.0-GA
    Eclipse Graphical Editing Framework, Version: 3.2.1.v20060921, Build id: 20060921-1617
    Eclipse Platform: Version: 3.2.1.r321_v20060921-b_XVA-INSQSyMtx, Build id: M20060921-0945
    Eclipse RCP: Version: 3.2.1.r321_v20060801-2ekW2BxmcpPUOoq, Build id: M20060921-0945
    Eclipse Java Development Tools: Version: 3.2.1.r321_v20060905-R4CM1Znkvre9wC-, Build id: M20060921-0945
    Eclipse Project SDK: Version: 3.2.1.r321_v20060801-tQ1w49KnTArT0FZ, Build id: M20060921-0945
    Eclipse startup command=-os win32 -ws win32 -arch x86-launcher C:\Program Files\MyEclipse Enterprise Workbench 5.1.0 GA\eclipse\eclipse.exe
    -name Eclipse -showsplash 600 -exitdata a90_80 -vm C:\Program Files\Java\jdk1.5.0_06\bin\javaw.exe

    #265558 Reply

    Haris Peco
    Member

    pierdeux,

    You have Hibernate 3.0 SQLQuery in your path anyhow

    Regards

    #265559 Reply

    pierdeux
    Member

    @support-snpe wrote:

    You have Hibernate 3.0 SQLQuery in your path anyhow

    Thank you for the reply, but I am not sure how I am meant to interpret it.
    1) Do you mean that as a statement: I have Hibernate 3.0 in my path and I shouldn’t have it, hence my problem. (Then how do I fix that?)
    2) Or do you mean that, given I have Hibernate 3.0 in my (class)path, it’ll be all right once I deploy outside Eclipse. (But, in the meantime, I can’t compile within MyEclipse.)

    #265567 Reply

    Haris Peco
    Member

    You can try next :

    – make new project and add Hibernate 3.1 capabilties (original libraries from MyEclipse)
    – try your case

    for your project :
    You have to change your project classpath (right click on project, choose Build Path and change libraries in Libraries tab) and no in MyEclipse Preferences

    Regards

    #265569 Reply

    pierdeux
    Member

    @support-snpe wrote:

    You can try next :

    – make new project and add Hibernate 3.1 capabilties (original libraries from MyEclipse)
    – try your case

    Yup. That seems to work. Thank you!!!

    #265574 Reply

    pierdeux
    Member

    I had never played with MyEclipse’s build path (I had only ever played with my own buildpath, through Ant).

    Finally I realized why I had been puzzling all along: Eclipse was using the hibernate3.jar file contained in its own Spring library. That’s why changing Hibernate‘s own version of the hibernate3.jar library had no effect, until I removed the Spring core entirely (which, anyway, I replaced by my copy of Spring 2.0).

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: wrong method signature: Hibernate vs MyEclipse

You must be logged in to post in the forum log in