[Hibernate-JIRA] Created: (HHH-2735) Query . setLockMode cannot find the alias when the query defines a select clause
by Tamir Solomon (JIRA)
Query . setLockMode cannot find the alias when the query defines a select clause
--------------------------------------------------------------------------------
Key: HHH-2735
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2735
Project: Hibernate3
Issue Type: Bug
Reporter: Tamir Solomon
I tried to perform the following :
Query q1 = session.createQuery("select serverIP.server from ServerIP serverIP where serverIP.ip = :ipStr");
q1.setLockMode("serverIP",LockMode.NONE);
q1.setParameter("ipStr", ip);
q1.list();
and i get this error :
Frame : java.lang.IllegalArgumentException: alias not found: serverIP
at org.hibernate.loader.hql.QueryLoader.applyLocks(QueryLoader.java:299)
at org.hibernate.loader.Loader.preprocessSQL(Loader.java:189)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1529)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2211)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
at org.hibernate.loader.Loader.list(Loader.java:2090)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:388)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
--
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
13 years, 6 months
[Hibernate-JIRA] Created: (HHH-5926) Bugs in HQL (order by)
by Ahmed Ali Elsayed Ali Soliman (JIRA)
Bugs in HQL (order by)
----------------------
Key: HHH-5926
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5926
Project: Hibernate Core
Issue Type: Bug
Components: query-hql, query-sql
Affects Versions: 3.6.1
Environment: Application Server: Tomcat 7.0.8
Database: Oracle 11g
Reporter: Ahmed Ali Elsayed Ali Soliman
Attachments: Beans & Mappings.rar
*there is a big problem in HQL & the generated SQL*
this is the hibernate properties in XML
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.query.substitutions">true 'T', false 'F'</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
<prop key="hibernate.generate_statistics">true</prop>
there is a bug in HQL when i make query.list(hql)
HQL:
select distinct
service.module.component.system,
service.module.component ,
service.module
from Service as service
where service.id in (928, 415)
order by service.module.component.system.orderBy
the generated SQL is
select
distinct system3_.ID as ID149_0_,
component2_.ID as ID150_1_,
module1_.ID as ID151_2_,
system3_.DESCRIPTION as DESCRIPT2_149_0_,
system3_.NAME as NAME149_0_,
system3_.ORDER_BY as ORDER7_149_0_,
system3_.MENU_ID as MENU8_149_0_,
component2_.NAME as NAME150_1_,
component2_.SYSTEM_ID as SYSTEM3_150_1_,
component2_.DESCRIPTION as DESCRIPT4_150_1_,
component2_.ORDER_BY as ORDER8_150_1_,
component2_.PARENT_COMPONENT_ID as PARENT9_150_1_,
module1_.NAME as NAME151_2_,
module1_.WEB_DIRECTORY as WEB3_151_2_,
module1_.MODULE_PATH as MODULE4_151_2_,
module1_.DESCRIPTION as DESCRIPT5_151_2_,
module1_.COMPONENT_ID as COMPONENT9_151_2_,
module1_.ORDER_BY as ORDER10_151_2_
from
SERVICES service0_,
MODULES module1_,
COMPONENTS component2_
inner join
SYSTEMS system3_
on component2_.SYSTEM_ID=system3_.ID,
*SYSTEMS system9_*
where
service0_.MODULE_ID=module1_.ID
and module1_.COMPONENT_ID=component2_.ID
and component2_.SYSTEM_ID=system9_.ID
and (
service0_.ID in (
928 , 415
)
)
order by
*system9_.ORDER_BY*
the errors are
- SQL Error: 1791, SQLState: 42000
- ORA-01791: not a SELECTed expression
the generated SQL is wrong because it add system9_ and no need for it, it has already system3_
there is a column in System bean called orderBy
the hierarchy of beans like this (Service --> Module --> Component --> System)
i attached the beans and mapping
*NOTE: the hql works fine on Hibernate 3.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
13 years, 6 months
[Hibernate-JIRA] Created: (HHH-4582) Repeated column in mapping for entity in composite id
by Franck Bisti (JIRA)
Repeated column in mapping for entity in composite id
-----------------------------------------------------
Key: HHH-4582
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4582
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1
Reporter: Franck Bisti
Priority: Minor
Attachments: PersistentClass.java
I have a composite-id with 2 manytoone. The two manytoone are composed by 3 columns each. They share 2 columns.
@Embeddable
public class FooBarId implements Serializable {
@ManyToOne()
@JoinColumns({
@JoinColumn(name="FOO_BAR1", referencedColumnName="FOO_BAR1",nullable=false, updatable=true, insertable=true),
@JoinColumn(name="FOO_BAR2", referencedColumnName="FOO_BAR2",nullable=false, updatable=true, insertable=true),
@JoinColumn(name="FOO_ID", referencedColumnName="ID",nullable=false, updatable=true, insertable=true)
})
private Foo foo;
/** Attribute*/
@ManyToOne()
@JoinColumns({
@JoinColumn(name="FOO_BAR1", referencedColumnName="FOO_BAR1",nullable=false, updatable=false, insertable=false),
@JoinColumn(name="FOO_BAR2", referencedColumnName="FOO_BAR2",nullable=false, updatable=false, insertable=false),
@JoinColumn(name="BAR_ID", referencedColumnName="ID",nullable=false, updatable=false, insertable=false)
})
private Bar bar;
Exception :
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: com.test.FooBar column: FOO_BAR2 (should be mapped with insert="false" update="false")
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:670)
at org.hibernate.mapping.PersistentClass.checkColumnDuplication(PersistentClass.java:711)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:468)
at org.hibernate.mapping.RootClass.validate(RootClass.java:215)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1135)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1320)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:854)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
I have the "Repeated column in mapping" exception because Hibernate doesn't use the insertable and updtable property in the PersistentClass.checkColumnDuplication for composite-id.
I have modified the PersistentClass.checkColumnDuplication() by use of getColumnUpdateability code and it seems to works fine (see attached file)
I don't know if that can help
--
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
13 years, 6 months
[Hibernate-JIRA] Created: (HHH-3361) LazyInitializationException generate an error message in the logs
by benoit heinrich (JIRA)
LazyInitializationException generate an error message in the logs
-----------------------------------------------------------------
Key: HHH-3361
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3361
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.3.0.CR1
Reporter: benoit heinrich
Priority: Minor
Hi,
When a LazyInitializationException is thrown a log message is automatically created by the exception class because of the line 19 in the LIE class:
LoggerFactory.getLogger( LazyInitializationException.class ).error( msg, this );
An exception should not write log messages, this is part of the application that handle the exception that should decide either or nor a log message should be created.
The exception should just carry all information with it and no more.
Actually this is causing a serious problem to one of the application I'm working on because LIE is a normal exception and is caught and handled correctly and each time a LIE is thrown by hibernate I'm getting a full stack trace in the logs (which is wrong in my case because the exception is handled correctly).
Also I don't want to change the log4j settings to ignore the LIE because I'd like to know when I get a LIE that is not caught.
So my suggestion is to simply remove the Log entry from the LIE constructor since normally this message is anyway redundant because if the exception is not caught the application will dump the exception in most of the time.
Cheers,
/Benoit
--
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
13 years, 6 months