title: java.lang.IllegalArgumentException with toplink and JPA
body: <p>I've a problem with JPA, whenever execute this query </p>
  
  <pre><code>@NamedQuery(name = "Usuario.getUsuarioIntento", query = "SELECT  u.intentos_id FROM Usuario u WHERE u.username = :username and u.borrado = 0")
  </code></pre>
  
  <p>i get this error:</p>
  
  <pre><code>java.lang.IllegalArgumentException: NamedQuery of name: Usuario.getUsuarioIntento not found.
  </code></pre>
  
  <p>But if i execute this query </p>
  
  <pre><code>@NamedQuery(name = "Usuario.getUsuarioIntento", query = "SELECT  u.id FROM Usuario u WHERE u.username = :username and u.borrado = 0")
  </code></pre>
  
  <p>Work fine,Why?</p>
  
  <p>My table,Usuario:</p>
  
  <p><a href="http://i48.tinypic.com/4kxj03.png" rel="nofollow">MY USER TABLE</a></p>
  
  <p>i try with other column as  'superusuario','version_jpa' and doesn't work, the only columns that work fine are 'id,'borrado' and 'username'</p>
  
  <p>Class Usuario:</p>
  
  <pre><code>@Temporal(TemporalType.TIMESTAMP)
  private Date                fechaCreacion;
  
  @Id
  @GeneratedValue (strategy=GenerationType.AUTO)
  private int                 id;
  
  @OneToOne(cascade = CascadeType.ALL)
  private Password            password;
  
  @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REFRESH}, fetch = FetchType.LAZY)
  private List&lt;Password&gt;      clavesAntiguas;
  
  @OneToOne
  private Persona             persona;
  
  private String              sessionId;
  
  private String              username;
  
  @ManyToOne(cascade = CascadeType.REFRESH)
  private Rol                 rol;
  
  @ManyToOne(cascade = CascadeType.REFRESH)
  private Perfil              perfil;
  
  @OneToOne (cascade = CascadeType.ALL)
  private IntentosBloqueo     intentos;
  
  private boolean             superUsuario;
  
  private int                 borrado;
  private int                 esManager;
  
  @OneToMany ( cascade = {CascadeType.ALL} , fetch = FetchType.LAZY)
  private Collection&lt;UsuarioSociedad&gt; sociedades; 
  
  @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
    @JoinTable (name="USR_UND_VIS",
    joinColumns={
     @JoinColumn (name="ID_USU", table="USUARIO", referencedColumnName="ID"),
    },
    inverseJoinColumns= 
     @JoinColumn (name="ID_UNI", table="UND_ORG", referencedColumnName="ID")
    )
    private List&lt;UnidadOrganizativa&gt; unidadesVisibles;
  
  @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
    @JoinTable (name="USR_UND_DIS",
    joinColumns={
     @JoinColumn (name="ID_USU", table="USUARIO", referencedColumnName="ID"),
    },
    inverseJoinColumns= 
     @JoinColumn (name="ID_UNI", table="UND_ORG", referencedColumnName="ID")
    )
    private List&lt;UnidadOrganizativa&gt; unidadesDisponibles;
  </code></pre>