facebook

find(String, String, NullableType) undefined for Session

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

    I get

    The method find(String, String, NullableType) is undefined for the type Session

    when writing

    
                    List users = sess.find(
                            "select users.active " + 
                            "from Mailbox as users " +
                            "where users.username = ? ",
                            uid,
                            Hibernate.STRING
                            );
    
    

    Seems like org.hibernate.Session doesn’t support the method find …

    #248164 Reply

    I’m using
    Eclipse 3.1.1
    MyEclipse 4.1.0 updated to Version: 4.1.1 GA

    This is the Mailbox.hbm.xml:

    
     <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <!-- 
        Mapping file autogenerated by MyEclipse - Hibernate Tools
    -->
    <hibernate-mapping>
        <class name="theo.feperic2.hib.Mailbox" table="mailbox" catalog="postfix">
            <id name="username" type="string">
                <column name="username" />
                <generator class="assigned" />
            </id>
            <property name="password" type="string">
                <column name="password" not-null="true" />
            </property>
            <property name="name" type="string">
                <column name="name" not-null="true" />
            </property>
            <property name="maildir" type="string">
                <column name="maildir" not-null="true" />
            </property>
            <property name="quota" type="integer">
                <column name="quota" not-null="true" />
            </property>
            <property name="domain" type="string">
                <column name="domain" not-null="true" />
            </property>
            <property name="created" type="timestamp">
                <column name="created" length="19" not-null="true" />
            </property>
            <property name="modified" type="timestamp">
                <column name="modified" length="19" not-null="true" />
            </property>
            <property name="active" type="byte">
                <column name="active" not-null="true" />
            </property>
        </class>
    </hibernate-mapping>
    
    #248165 Reply

    Configuration Summary

    
     *** Date: Thu Mar 09 16:05:39 CET 2006
    
    *** System properties:
    OS=WindowsXP
    OS version=5.1
    Java version=1.4.2_10
    
    *** MyEclipse details:
    MyEclipse Enterprise Workbench
    
    Version: 4.1.1 GA
    Build id: 20060228-4.1.1-GA
    
    *** Eclipse details:
    Eclipse SDK
    
    Version: 3.1.1
    Build id: M20050929-0840
    
    Eclipse Platform
    
    Version: 3.1.1
    Build id: M20050929-0840
    
    Eclipse RCP
    
    Version: 3.1.1
    Build id: M20050929-0840
    
    Eclipse Java Development Tools
    
    Version: 3.1.1
    Build id: M20050929-0840
    
    Eclipse Plug-in Development Environment
    
    Version: 3.1.1
    Build id: M20050929-0840
    
    Eclipse Project SDK
    
    Version: 3.1.1
    Build id: M20050929-0840
    
    Eclipse startup command=-os
    win32
    -ws
    win32
    -arch
    x86
    -launcher
    C:\eclipse\eclipse.exe
    -name
    Eclipse
    -showsplash
    600
    -exitdata
    944_38
    -vm
    C:\Programmi\java\j2re1.4.2_10\bin\javaw.exe
    
    
    
    #248171 Reply

    Haris Peco
    Member

    casc,

    You are correct : org.hibernate.Session doesn’t support find.You have 2 choices

    – use org.hibernate.clasic.Session
    or (better)
    – use

    List users = sess.createQuery(
                      "select users.active " +
                      "from Mailbox as users " +
                      "where users.username = ? ").setParemeter(
                      uid,
                      Hibernate.STRING).list();
                       
    #248172 Reply

    thanx

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: find(String, String, NullableType) undefined for Session

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