[Hibernate-JIRA] Created: (HHH-5486) The interface method org.hibernate.id.ResultSetIdentifierConsumer.consumeIdentifier(ResultSet resultSet) should throw SQLException
by Chris Webb (JIRA)
The interface method org.hibernate.id.ResultSetIdentifierConsumer.consumeIdentifier(ResultSet resultSet) should throw SQLException
----------------------------------------------------------------------------------------------------------------------------------
Key: HHH-5486
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5486
Project: Hibernate Core
Issue Type: Improvement
Affects Versions: 3.6.0.Beta2, 3.6.0.Beta1, 3.5.4, 3.5.3, 3.5.2, 3.5.1, 3.5.0-Final, 3.5.0-CR-2, 3.5.0-CR-1, 3.5.0-Beta-4, 3.5.0-Beta-3, 3.5.0-Beta-2
Reporter: Chris Webb
Priority: Minor
Implementations of this method will likely need to handle SQLException when accessing the ResultSet instance and that exception should be thrown up to the calling method.
--
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
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-4443) Allow generic handling of any Hibernate type for post-insert generated identifiers
by Steve Ebersole (JIRA)
Allow generic handling of any Hibernate type for post-insert generated identifiers
----------------------------------------------------------------------------------
Key: HHH-4443
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4443
Project: Hibernate Core
Issue Type: Improvement
Components: core
Reporter: Steve Ebersole
Assignee: Steve Ebersole
Fix For: 3.5
See HB-92 for the original request. Much of the discussion unfortunately occurred in a private email thread with the original requester, but here is the proposed solution:
Steve Ebersole <steve(a)hibernate.org> wrote:
The "more correct" solution is along the lines a contract to allow the
type to handle this like you said. I'm thinking something like an
optional interface for the type to publish that fact:
public interface ResultSetIdentifierConsumer {
public Serializable consumeIdentifier(ResultSet resultSet);
}
then IdentifierGeneratorFactory (called IdentifierGeneratorHelper now
btw) can say:
public static Serializable get(ResultSet rs, Type type) ... {
if ( type instanceof ResultSetIdentifierConsumer ) {
return ( ( ResultSetIdentifierConsumer ) type ).consumeIdentifier( rs );
}
Class clazz = type.getReturnedClass();
if ( clazz == Long.class ) {
return new Long( rs.getLong( 1 ) );
}
else if ( clazz == Integer.class ) {
return new Integer( rs.getInt( 1 ) );
}
else if ( clazz == Short.class ) {
return new Short( rs.getShort( 1 ) );
}
else if ( clazz == String.class ) {
return rs.getString( 1 );
}
else {
throw ...
}
}
and you can define a type :
public class MyCustomLongIdType ... implements ResultSetIdentifierConsumer ... {
public Serializable consumeIdentifier(ResultSet resultSet) {
return new MyCustomLongId( resultSet.getLong( 1 ) );
}
...
}
--
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
14 years, 4 months
[Hibernate-JIRA] Resolved: (HHH-1909) Incomplete insert and update using <<insert="false" update="false">>
by Gail Badner (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1909?page=c... ]
Gail Badner resolved HHH-1909.
------------------------------
Assignee: Gail Badner
Resolution: Rejected
Please use the user forum (https://forum.hibernate.org/) for help.
> Incomplete insert and update using <<insert="false" update="false">>
> --------------------------------------------------------------------
>
> Key: HHH-1909
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1909
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.0 final
> Reporter: Peppe
> Assignee: Gail Badner
> Priority: Critical
>
> Hi, I've seen lots of people have problems using complex mappings.
> This is my situation, I've three mappings:
> <hibernate-mapping>
> <class name="unibiblio.dati.anagrafica.DAO.Persone" table="persone">
> <composite-id name="id" class="unibiblio.dati.anagrafica.DAO.PersoneId">
> <key-property name="idUtente" type="java.lang.Integer">
> <column name="id_utente" />
> </key-property>
> <key-property name="codbib" type="java.lang.Integer">
> <column name="codbib" />
> </key-property>
> </composite-id>
> <many-to-one name="dizTitolidistudio" class="unibiblio.dati.anagrafica.DAO.DizTitolidistudio" update="false" insert="false" fetch="select">
> <column name="lingua" length="2" />
> <column name="codice_titolostudio" length="1" />
> </many-to-one>
> <many-to-one name="dizLingue" class="unibiblio.dati.anagrafica.DAO.DizLingue" fetch="select">
> <column name="lingua" length="2" />
> </many-to-one>
> <many-to-one name="dizProfessioni" class="unibiblio.dati.anagrafica.DAO.DizProfessioni" update="false" insert="false" fetch="select">
> <column name="lingua" length="2" />
> <column name="codprofessione" length="2" not-null="true" />
> </many-to-one>
> <property name="userName" type="string">
> <column name="user_name" length="30" />
> </property>
> <property name="password" type="string">
> <column name="password" length="30" />
> </property>
> .
> .
> .
> .
> .
> .
> </class>
> </hibernate-mapping>
> <hibernate-mapping>
> <class name="unibiblio.dati.anagrafica.DAO.DizTitolidistudio" table="diz_titolidistudio">
> <composite-id name="id" class="unibiblio.dati.anagrafica.DAO.DizTitolidistudioId">
> <key-property name="lingua" type="string">
> <column name="lingua" length="2" />
> </key-property>
> <key-property name="codiceTitolostudio" type="string">
> <column name="codice_titolostudio" length="1" />
> </key-property>
> </composite-id>
> <many-to-one name="dizLingue" class="unibiblio.dati.anagrafica.DAO.DizLingue" update="false" insert="false" fetch="select">
> <column name="lingua" length="2" not-null="true" />
> </many-to-one>
> <property name="titolo" type="string">
> <column name="titolo" length="50" not-null="true" />
> </property>
> <set name="persones" inverse="true">
> <key>
> <column name="lingua" length="2" />
> <column name="codice_titolostudio" length="1" />
> </key>
> <one-to-many class="unibiblio.dati.anagrafica.DAO.Persone" />
> </set>
> </class>
> </hibernate-mapping>
> <hibernate-mapping>
> <class name="unibiblio.dati.anagrafica.DAO.DizProfessioni" table="diz_professioni">
> <composite-id name="id" class="unibiblio.dati.anagrafica.DAO.DizProfessioniId">
> <key-property name="lingua" type="string">
> <column name="lingua" length="2" />
> </key-property>
> <key-property name="codprofessione" type="string">
> <column name="codprofessione" length="2" />
> </key-property>
> </composite-id>
> <many-to-one name="dizLingue" class="unibiblio.dati.anagrafica.DAO.DizLingue" update="false" insert="false" fetch="select">
> <column name="lingua" length="2" not-null="true" />
> </many-to-one>
> <property name="professione" type="string">
> <column name="professione" length="50" />
> </property>
> <set name="persones" inverse="true">
> <key>
> <column name="lingua" length="2" />
> <column name="codprofessione" length="2" not-null="true" />
> </key>
> <one-to-many class="unibiblio.dati.anagrafica.DAO.Persone" />
> </set>
> </class>
> </hibernate-mapping>
> The problem is when I try to insert a new persone it make an incomplete SQL statement because
> <<update="false" insert="false">> in <many-to-one name="dizTitolidistudio"> and <many-to-one name="dizProfessioni">
> causes hiding setting of columns "codice_titolostudio" and "codprofessione" in the generated SQL
> Deleting that tag, of course, give me the exception
> ERROR [STDERR] org.hibernate.MappingException: Repeated column in mapping for entity: unibiblio.dati.anagrafica.DAO.Persone column: lingua (should be mapped with insert="false" update="false")
>
> I workarounded this extracting "codice_titolostudio" and "codprofessione" as properties in Persone and setting them with
> classes but I don't like this. Am I wrong or is it a bug?
--
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
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-5455) withClause dublicates in SQL during many-to-many association relation
by Alexey Zhukov (JIRA)
withClause dublicates in SQL during many-to-many association relation
---------------------------------------------------------------------
Key: HHH-5455
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5455
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.0.Beta2, 3.5.0-Final
Reporter: Alexey Zhukov
{code:title=Test1.java}
@Entity
@Table(name = "FA_TEST1")
public class Test1 {
private Long id;
@Column(name = "FA_TEST1_ID")
@Id
public Long getId() { return id;}
public void setId(Long id) { this.id = id; }
private Set < Test2 > test2s;
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "FA_TEST1_TEST2",
joinColumns = @JoinColumn(name = "TEST1_ID"),
inverseJoinColumns = @JoinColumn(name = "TEST2_ID")
)
@ForeignKey(name = "FA_TEST1_ID_FK", inverseName = "FA_TEST2_ID_FK")
public Set<Test2> getTest2s() { return test2s; }
public void setTest2s(Set<Test2> test2s) { this.test2s = test2s; }
}
{code}
{code:title=Test2.java}
@Entity
@Table(name = "FA_TEST2")
public class Test2 {
private Long id;
@Column(name = "FA_TEST2_ID")
@Id
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
}
{code}
Sample criteria java-code ...
{code:title=Sample criteria code}
Test1 test1 = (Test1) session.createCriteria(Test1.class).
createAlias("test2s", "test2s",
CriteriaSpecification.LEFT_JOIN,
Restrictions.ge("id", 5L)).
add(Restrictions.idEq(1L)).uniqueResult();
{code}
... produces following SQL-code:
{code:SQL}
select
this_.FA_TEST1_ID as FA1_0_1_,
test2s3_.TEST1_ID as TEST1_0_3_,
test2s1_.FA_TEST2_ID as TEST2_3_,
test2s1_.FA_TEST2_ID as FA1_1_0_
from
eisrsn2.FA_TEST1 this_
left outer join
eisrsn2.FA_TEST1_TEST2 test2s3_
on this_.FA_TEST1_ID=test2s3_.TEST1_ID
and (
test2s1_.FA_TEST2_ID>=?
)
left outer join
eisrsn2.FA_TEST2 test2s1_
on test2s3_.TEST2_ID=test2s1_.FA_TEST2_ID
and (
test2s1_.FA_TEST2_ID>=?
)
where
this_.FA_TEST1_ID = ?
{code}
Following part sould be mentioned once:
{code}
and (
test2s1_.FA_TEST2_ID>=?
)
{code}
[Similar issue|http://opensource.atlassian.com/projects/hibernate/browse/HHH-5264]
--
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
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-3006) ConcurrentModificationException in AbstractBatcher results in infinite loop
by Stefan Hauk (JIRA)
ConcurrentModificationException in AbstractBatcher results in infinite loop
---------------------------------------------------------------------------
Key: HHH-3006
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3006
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.5, 3.2.4.sp1, 3.2.4, 3.2.3
Environment: Hibernate 3.2.5.ga
MySQL 5.0.42
Reporter: Stefan Hauk
Priority: Minor
Here is a piece of code from org.hibernate.jdbc.AbstractBatcher's closeStatements() method:
Iterator iter = resultSetsToClose.iterator();
while ( iter.hasNext() ) {
try {
logCloseResults();
( (ResultSet) iter.next() ).close();
}
catch (SQLException e) {
// no big deal
log.warn("Could not close a JDBC result set", e);
}
catch (Throwable e) {
// sybase driver (jConnect) throwing NPE here in certain cases
log.warn("Could not close a JDBC result set", e);
}
}
resultSetsToClose.clear();
In case there is a ConcurrentModificationException thrown when iterating over the resultSetsToClose HashSet the exception will be caught by the catch(Throwable) clause. However, the iteration may continue infinitely because of the corrupted HashSet. This pegs one CPU and logs the following stack trace over and over again:
28/11 20:16:50 WARN AbstractBatcher [resin-tcp-connection-myserver:6001-15] Could not close a JDBC result set
java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(HashMap.java:841)
at java.util.HashMap$KeyIterator.next(HashMap.java:877)
at org.hibernate.jdbc.AbstractBatcher.closeStatements(AbstractBatcher.java:314)
at org.hibernate.jdbc.ConnectionManager.cleanup(ConnectionManager.java:382)
at org.hibernate.jdbc.ConnectionManager.close(ConnectionManager.java:324)
at org.hibernate.impl.SessionImpl.close(SessionImpl.java:298)
at org.springframework.orm.hibernate3.SessionFactoryUtils.closeSession(SessionFactoryUtils.java:774)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.closeSession(OpenSessionInViewFilter.java:252)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:183)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:188)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:178)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:419)
at com.caucho.server.port.TcpConnection.run(TcpConnection.java:389)
at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:492)
at com.caucho.util.ThreadPool.run(ThreadPool.java:425)
at java.lang.Thread.run(Thread.java:595)
The catch(Throwable) block was added in Hibernate 3.2.3 if I saw that correctly. Apparently the reason was to catch a NPE thrown by a sybase driver here, but catching Throwable catches more than that and produces this side-effect.
Now I do realize that the ConcurrentModificationException might be caused by not using Hibernate in a correct way, but I haven't determined the cause for it yet. However, I do think that Hibernate should fail more gracefully than it currently does.
--
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
14 years, 4 months