[Hibernate-JIRA] Commented: (HHH-1697) OracleDialect fails to recognize sequence accessible through syonyms when validating schema
by Roland Hofmann (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1697?page=c... ]
Roland Hofmann commented on HHH-1697:
-------------------------------------
Following there is a little bit adapted version of the first fixxing.
The precondition is that the synonym names must be equals with the sequence name in the view.
Normal this is the case.
public String getQuerySequencesString() {
return "select sequence_name from user_sequences "
+ "union "
+ "select synonym_name from user_synonyms us "
+ "where exists ( select 1 from all_sequences aseq where us.synonym_name = aseq.sequence_name)";
}
With this solution i get the informations not from all objects but from all sequences.
> OracleDialect fails to recognize sequence accessible through syonyms when validating schema
> -------------------------------------------------------------------------------------------
>
> Key: HHH-1697
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1697
> Project: Hibernate3
> Issue Type: Bug
> Environment: Hibernate 3.1.2, Hibernate 3.1.3 Oracle 10g
> Reporter: Bjørn Bjerkeli
> Priority: Minor
> Attachments: Oracle9Dialect.java
>
>
> The Dialect implementations in OracleDialect and Oracle9Dialect fails to recognize sequences upon validation when they are accesssed through synonyms
> because the user_sequences table will not create when the sequence is acced through a synonym. This is needed when using hibernate.hbm2ddl.auto=validate
> which is a very useful feature.
> Thus sequences returned by:
> public String getQuerySequencesString() {
> return "select sequence_name from user_sequences";
> }
> will mot identify sequences accessible using a synonym.
> By using this implementation:
> public String getQuerySequencesString() {
> return "select sequence_name from user_sequences " +
> "union " +
> "select synonym_name from user_synonyms us " +
> "where exists (select 1 from all_objects ao where object_type='SEQUENCE' and " +
> "us.table_name = ao.object_name)";
> }
> orale will also return sequences acccessible though synonyms.
--
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
16 years, 1 month
[Hibernate-JIRA] Created: (HHH-2183) org.hibernate.LazyInitializationException: failed to lazily initialize a collection while using lazy set with key as property-ref in the mapping
by Artur Jonak (JIRA)
org.hibernate.LazyInitializationException: failed to lazily initialize a collection while using lazy set with key as property-ref in the mapping
------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-2183
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2183
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.1.3
Environment: Oracle 9i
Reporter: Artur Jonak
Priority: Blocker
Attachments: hibernate-testcase.zip
I have an entity which can have multiple titles located in a separate table. I mapped this as a set where key attribute references other property of the entity:
<set name="titles" table="TTitle" cascade="none" lazy="true" inverse="true" mutable="false">
<key column="ID" property-ref="parentId"/>
<!--key column="ID"/-->
<element type="string" column="title"/>
</set>
when I try to display this set I get an exception:
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: test.lazysetinit.Record.titles, no session or session was closed
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
...
The entire mapping is as follows:
<class name="Record" table="TRecord" mutable="false">
<id name="id" type="long">
<column name="ID" sql-type="number" length="12" not-null="true" unique="true"/>
</id>
<set name="titles" table="TTitle" cascade="none" lazy="true" inverse="true" mutable="false">
<key column="ID" property-ref="parentId"/>
<!--key column="ID"/-->
<element type="string" column="title"/>
</set>
<join table="TRecordInfo" inverse="true" fetch="join" optional="false">
<key column="ID"/>
<property name="parentId" not-null="false" />
<property name="status" />
</join>
</class>
Attached the test case: test.lazysetinit.LazySetInitTest. DB schema is located in test/conf/lazysetinit/schema.sql
Regards,
Artur
--
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
16 years, 1 month
[Hibernate-JIRA] Commented: (HHH-1306) HQL parsing problem with join fetching of arrays/collections of values
by Paul Benedict (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1306?page=c... ]
Paul Benedict commented on HHH-1306:
------------------------------------
This issue exists in 3.2.6 using the "select new MyBean(...)" syntax
> HQL parsing problem with join fetching of arrays/collections of values
> ----------------------------------------------------------------------
>
> Key: HHH-1306
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1306
> Project: Hibernate3
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.1
> Environment: SQL Server
> Reporter: Peter Fassev
> Assignee: Steve Ebersole
> Priority: Minor
> Fix For: 3.1.2
>
> Attachments: testcase.zip
>
>
> There is a parsing exception, which is thrown, when executing the following HQL query (note that I only want to fetch an association):
> select o from A as o inner join fetch o.b as e
> The A class looks like:
> public class A {
> private int id;
> private String[] b;
> }
> And the mapping is:
> <class name="A" table="A">
> <cache usage="read-write"/>
> <id type="int" name="id" unsaved-value="0">
> <generator class="native"/>
> </id>
> <array name="b" table="AB" cascade="all">
> <cache usage="read-write"/>
> <key column="aId"/>
> <index column="index_"/>
> <element column="b" type="java.lang.String" length="1024" not-null="true"/>
> </array>
> </class>
> Than following happens:
> java.lang.NullPointerException
> at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:175)
> at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:637)
> at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:466)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:643)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:279)
> at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:227)
> at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:218)
> at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
> at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:105)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:74)
> at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:53)
> at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
> at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:108)
> at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:88)
> at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1540)
> at A.main(A.java:76)
> Exception in thread "main"
> IMPORTANT: Please note, that the previous exception is a secondary exception, which is due to a small bug in the throw clause. The actual (unthrown) exception (taken from the source of SelectClause class) should be read as:
> ...
> throw new QueryException(
> "query specified join fetching, but the owner " +
> "of the fetched association was not present in the select list " +
> "(" + fromElement.getClassName() + " -> " + fromElement.getRealOrigin().getClassName() + ")"
> ....
> But it can not be throwed, because the fromElement is actually NULL, thus the NullPointerException.
> There a simple workaround for this. When the "select" clause (which is actually not needed) is removed from the query, there is no such exception: "from A as o inner join fetch o.b as e" - this query does not produce an exception.
> But as far as I can see from the documentation, the select clause is perfectly legal, so I suppose the problem lies somewhere in the HQL Parser. Also, I am having the same problem with list or sets of components, instead of arrays.
> The problem is not present in Hibernate 3.0.
> Please see the attached Test case.
--
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
16 years, 1 month
[Hibernate-JIRA] Commented: (HHH-1587) 'true' and 'false' as keywords for PostgreSQL dialect
by Etienne Bernard (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1587?page=c... ]
Etienne Bernard commented on HHH-1587:
--------------------------------------
Hi Diego,
Honestly I don't use PostgreSQL anymore, and this bug is really old. I think it was solved during the 3.2 development phase. I think you can close it without any problem.
> 'true' and 'false' as keywords for PostgreSQL dialect
> -----------------------------------------------------
>
> Key: HHH-1587
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1587
> Project: Hibernate3
> Issue Type: Improvement
> Reporter: Etienne Bernard
> Assignee: Diego Plentz
> Priority: Minor
>
> I'm using the PostgreSQL dialect with hibernate 3.1.
> I tried to add a ' where="active=true" ' restriction on my collection mapping.
> Unfortunately, it was incorrectly interpreted as a column name by the query parser :
> FROM es.vodafone.tienda.model.Phone AS p JOIN p.activePhonePacks AS pp
> WHERE p.active=true
> where rewritten as :
> select phone0_.id as col_0_0_, activephon1_.id as col_1_0_ from phone phone0_ inner join phonepack activephon1_ on phone0_.id=activephon1_.phone and activephon1_.active=activephon1_.true where phone0_.active=true
> The solution seems to register "true" and "false" as keywords in the PostgreSQL dialect :
> registerKeyword("true");
> registerKeyword("false");
> Thanks.
--
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
16 years, 1 month