[hibernate-issues] [Hibernate-JIRA] Created: (HCANN-13) When mapping a domain on getter methods, if a @Formula is not in order with the other get methods, Hibernate generates an AND statement for the formula

Fabio Schmitz Tani (JIRA) noreply at atlassian.com
Thu Dec 10 12:14:09 EST 2009


When mapping a domain on getter methods, if a @Formula is not in order with the other get methods, Hibernate generates an AND statement for the formula
-------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HCANN-13
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HCANN-13
             Project: Hibernate Commons Annotations
          Issue Type: Bug
         Environment: Oracle 10g, Hibernate 3
            Reporter: Fabio Schmitz Tani


When mapping a domain on getter methods, if a @Formula is not in order with the other get methods, Hibernate generates an AND statement for the formula.

For example, a domain with 2 fields and a formula field:

<code>
private Integer id;
private String text;
private Integer countField;

@Id
@Column(name = "id")
public Integer getId()...

@Column(name = "text")
public String getText()...

public void setId(Integer id)...

public void setText(String txt)...

@Formula("(select count(*) from other table)")
public Integer getCount()...

public void setCount(Integer count)....
</code>

When searching with Criteria, Hibernate adds the Formula in the query as a requirement:
select this_.id, this_.txt, (select count(*) from other table) as count from table this_ where id = ? and ((select count(*) from other table)=?)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list