[Hibernate-JIRA] Created: (HHH-2412) Hibernate 3 cannot be compiled under JDK 6
by Ahmet A. Akin (JIRA)
Hibernate 3 cannot be compiled under JDK 6
------------------------------------------
Key: HHH-2412
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2412
Project: Hibernate3
Type: Task
Components: core
Versions: 3.2.1, 3.2.2
Environment: windows xp, JDK 6
Reporter: Ahmet A. Akin
Hibernate code cannot be compiled under JDK 6. Problems and possible solutions:
1- org.hibernate.jdbc.ResultSetWrapper implements ResultSet. But in Java 6, there are big changes in Resultset interface, and maybe 20+ more methods needs to be implemented in the ResultSetWrapper class. i would suggest eliminating this wrapper class once and for all, because it is only used in one method (in ColumnNameCache, getIndexForColumnName method) and i dont think there is a justification for using that wrapper class.
2- org.hibernate.lob.SerializableBlob needs to implement new Blob interface methods:
public void free() throws SQLException;
public InputStream getBinaryStream(long pos, long length) throws SQLException
But, if this class is publicly accesible or used by API's back compatibility issues needs to be checked.
3- Same as number 2, org.hibernate.lob.BlobImpl class needs to implement new Blob methods.
4- org.hibernate.lob.SerializableClob class needs to implent new Clob methods.
5- org.hibernate.lob.ClobImpl , same as 4.
In fact, Java 6 has a lot of JDBC improvements, maybe a java6 special extra package can be created., but that is a whole different issue.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
15 years, 2 months
[Hibernate-JIRA] Created: (ANN-786) Filters on collections are ignored
by Eric Ford (JIRA)
Filters on collections are ignored
----------------------------------
Key: ANN-786
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-786
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.2.0.ga
Environment: Hibernate 3.2; MySql 5.0.51a; Java 1.6
Stand-alone app - no server
Reporter: Eric Ford
I have two classes: Topic and Narrative. A topic has one-to-many narratives. I want to impose a filter such that only narratives with a particular state value are returned when I look up a topic.
@Entity
public class Topic
{
//unrelated attributes not shown
private Set<Narrative> narratives = new HashSet<Narrative>();
@OneToMany(mappedBy="topic")
@Filter(name="byState", condition=":state = state")
public Set<Narrative> getNarratives()
{
return narratives;
}
public void setNarratives(Set<Narrative> narratives)
{
this.narratives = narratives;
}
}
@Entity
@FilterDef(name="byState", defaultCondition=":state = state",
parameters=@ParamDef(name="state",type="string"))
@Filter(name="byState", condition=":state = state")
public class Narrative
{
private String content = "";
private String state = "";
private Topic topic = null;
//getters and setters not shown
}
@Test
public void FindSystemById(){
//for this test, the indicated topic has two narratives,
//one is "published" and the other is "draft"
session.enableFilter("byState").setParameter("state", "published");
Topic result = null;
result = TopicDao.findById(new Long(1), noLock); //
assertNotNull(result); //this always passes, as expected
System.out.println(result.getNarratives().size(); //this always returns 2
assertTrue(result.getNarratives().size() == 1); //this always fails, obviously
}
The sql code does not show the filter being applied when fetching the collection.
I've tried variations including adding the @Filter annotation to the getNarratives() method only and adding the @Filter annotation to the Narrative class only. I've also tried putting the @FilterDef annotation on the Topic class instead of the Narrative class. None of these variations has given the desired result of only one narrative returned from the getNarratives() method. I am coding with Java 1.6, Hibernate 3.2, and MySql 5.0.51a using Eclipse 3.4 and testing with JUnit 4.
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 2 months
[Hibernate-JIRA] Created: (HHH-2967) Cast to date in Formula still doesn't work
by Frederic Leitenberger (JIRA)
Cast to date in Formula still doesn't work
------------------------------------------
Key: HHH-2967
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2967
Project: Hibernate3
Issue Type: Bug
Components: query-criteria, query-hql, query-sql
Affects Versions: 3.2.5
Environment: Hibernate-Version: 3.2.5.ga
Oracle 9i/10g
Reporter: Frederic Leitenberger
Priority: Minor
Similar to HHH-473.
Oracle 10g supports trunc(TS). (TS is a timestamp)
Oracle 9i only supports trunc(cast(TS as date)) [and 10g supports this still too].
Therefore i need to add the cast to the Forumla.
@Basic
@Column(nullable = false, updatable = false)
@Temporal(TemporalType.TIMESTAMP)
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
@Formula(value = "trunc(cast(created as date))")
public Date getDate() {
return date
}
public void setDate(Date date {
this.date= date
}
This results in the following query:
select
eventlog0_.id as id9_0_,
eventlog0_.created as created9_0_,
.........
trunc(cast(eventlog0_.created as eventlog0_.date)) as formula6_0_
from
ICCS6.EventLog eventlog0_
where
eventlog0_.id=?
The alias in front of "date" is obviously misplaced there.
I also tried renaming the formula (since it was called "date"), but this didn't change the result.
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 2 months
[Hibernate-JIRA] Created: (ANN-593) Ability for an @NamedQuery on a @MappedSuperclass to be copied up to the subclass
by John Newman (JIRA)
Ability for an @NamedQuery on a @MappedSuperclass to be copied up to the subclass
---------------------------------------------------------------------------------
Key: ANN-593
URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-593
Project: Hibernate Annotations
Issue Type: Improvement
Components: binder
Affects Versions: 3.2.1
Environment: INFO Version:15 - Hibernate Annotations 3.2.1.GA
09:15:01,755 INFO Environment:500 - Hibernate 3.2.1
INFO SettingsFactory:81 - RDBMS: Microsoft SQL Server, version: 08.00.0760
09:15:06,114 INFO SettingsFactory:82 - JDBC driver: jTDS Type 4 JDBC Driver for MS SQL Server and Sybase, version: 1.2
09:15:06,255 INFO Dialect:151 - Using dialect: org.hibernate.dialect.SQLServerDialect
Reporter: John Newman
If I use a @MappedSuperclass (which is a very useful annotation btw) I have to manually copy any queries I want with taht class up to all subclasses. The binder should check any mapped superclasses and pull those named queries up. i.e.
/**
* Base User class that different projects user classes derive from.
* Hibernate annotations doesn't pick up that query, so you have to copy it up to your subclass
*/
@MappedSuperclass
@NamedQueries({
@NamedQuery(name="User.findByLoginName",
query="FROM User WHERE loginName = ?") // this is useless down here, i just put it here for reference
})
public class BaseUser<PK extends Serializable> extends IdEntity<PK> {
private static final long serialVersionUID = -4443522925041212381L;
protected String loginName;
@Column(unique=true)
public String getLoginName() {
return this.loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
}
/**
* Custom user class for a certain application
*/
@Entity
@Table(name="tbl_user")
@GenericGenerator(name=IdGen.NAME, strategy=IdGen.AUTO)
@NamedQueries({
@NamedQuery(name="User.findByLoginName",
query="FROM User WHERE loginName = ?") // had to copy this up from the base class
})
public class User extends BaseUser<Short> {
private static final long serialVersionUID = -6199544722824321999L;
private String firstName;
...
}
so in short it would be nice if the scanner would check for that and bind any named queries up to the subclass
--
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
15 years, 2 months