[Hibernate-JIRA] Created: (HHH-3314) "in elements" generated subquery table name not corrected translated on "insert into ... select" queries
by Bruno Mayerle Leite (JIRA)
"in elements" generated subquery table name not corrected translated on "insert into ... select" queries
--------------------------------------------------------------------------------------------------------
Key: HHH-3314
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3314
Project: Hibernate3
Issue Type: Bug
Components: query-hql
Affects Versions: 3.2.6, 3.2.5
Environment: Windows XP SP2
latest Java 1.4
XML mapping
Derby 10.4.1.3
Reporter: Bruno Mayerle Leite
Priority: Blocker
Attachments: bug_hibernate.zip
The following hql:
--------------------------------------------------------------------------------------------------------------------
sb.append( " insert into ValorIndicador ( indicador," );
sb.append( " tipoValor ) " );
sb.append( " select vi.indicador, " );
sb.append( " vi.tipoValor ");
sb.append( " from ValorIndicador vi, PerfilIndicador pi " );
sb.append( " where 1 = 1 " );
sb.append( " and vi.indicador = pi.indicador " );
sb.append( " and vi.tipoValor in elements( pi.cenarios ) " );
-------------------------------------------------------------------------------------------------------------------
after translation generates the following WRONG sql:
-------------------------------------------------------------------------------------------------------------------
insert
into
VALORINDICADOR
( indicador, tipovalor ) select
valorindic0_.indicador as col_0_0_,
valorindic0_.tipovalor as col_1_0_
from
VALORINDICADOR valorindic0_,
PERFILINDICADOR perfilindi1_
where
1=1
and valorindic0_.indicador=perfilindi1_.indicador
and (
valorindic0_.tipovalor in (
select
cenarios2_.cenario
from
cenarios cenarios2_
where
PERFILINDICADOR.id=cenarios2_.perfilindicador_id
)
)
-------------------------------------------------------------------------------------------------------------------
while without the "insert into" statement :
-------------------------------------------------------------------------------------------------------------------
sb.append( " select vi.indicador, " );
sb.append( " vi.tipoValor ");
sb.append( " from ValorIndicador vi, PerfilIndicador pi " );
sb.append( " where 1 = 1 " );
sb.append( " and vi.indicador = pi.indicador " );
sb.append( " and vi.tipoValor in elements( pi.cenarios ) " );
-------------------------------------------------------------------------------------------------------------------
it translates to the CORRECT sql:
-------------------------------------------------------------------------------------------------------------------
select
valorindic0_.indicador as col_0_0_,
valorindic0_.tipovalor as col_1_0_
from
VALORINDICADOR valorindic0_,
PERFILINDICADOR perfilindi1_
where
1=1
and valorindic0_.indicador=perfilindi1_.indicador
and (
valorindic0_.tipovalor in (
select
cenarios2_.cenario
from
cenarios cenarios2_
where
perfilindi1_.id=cenarios2_.perfilindicador_id
)
)
-------------------------------------------------------------------------------------------------------------------
Note that in the first generated sql, the table instance name of the "in elements" subquery is wrong. The entity name (PERFILINDICADOR) is used instead of the instance name (perfilindi1_).
In the second generated sql this problem doesn't occurs.
--
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
17 years, 10 months
[Hibernate-JIRA] Created: (HHH-3243) VARBINARY primary key with mysql doesn't function
by Marc Ewert (JIRA)
VARBINARY primary key with mysql doesn't function
-------------------------------------------------
Key: HHH-3243
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3243
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.1
Environment: MySQL-5.0.51a, hibernate-3.2.1.ga
Reporter: Marc Ewert
We have a 16-byte UUID type, which should be persisted in a VARBINARY (tinyblob) in a mysql database. But the primary key statement is invalid for mysql:
ERROR 11:34:13 [main] (SchemaExport.java:create:274) -
Unsuccessful:
create table T_GRI_USER (C_ID tinyblob not null, C_ATTRIBUTES
text, C_VERSION integer, C_PASSWORD varchar(255), C_VISIBILITIES
blob, C_STATE integer not null, C_LOGIN varchar(255) not null
unique, C_EMAIL varchar(255), primary key (C_ID))
ERROR 11:34:13 [main] (SchemaExport.java:create:275) - BLOB/TEXT
column 'C_ID' used in key specification without a key length
The statement should end with ... primary key (C_ID({length})). This has to be done in the class PrimaryKey, which forms this part of the statement without involving the Dialect.
The MySQLDialect has also a little bug, it doesn't write the length while defining the tinyblob column. But unfortunately this doesn't solve the SQL-Error. Unfortunately because the dialect is much better patchable for us as the PrimaryKey class deep in hibernate is...
--
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
17 years, 10 months
[Hibernate-JIRA] Created: (HBX-1061) hbm2java illegal code in @columns for one-to-one constrained=true relationship.
by Rodolfo Federico Gamarra (JIRA)
hbm2java illegal code in @columns for one-to-one constrained=true relationship.
-------------------------------------------------------------------------------
Key: HBX-1061
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1061
Project: Hibernate Tools
Issue Type: Bug
Components: hbm2java
Affects Versions: 3.2.beta11
Environment: hibernate-3.2.6.ga
Reporter: Rodolfo Federico Gamarra
Priority: Minor
Attachments: hibtest.zip
The generated java code is illegal in
@Columns( } )
public Principal getPrincipal() {
return this.principal;
}
Note the content of the annotation. The asociated Ant-Task runs succesfully.
There are two classes (Principal and Satellite) with shared primary keys. The second one has a "constrained=true" one-to-one relationship with the first, and a foreign key generator pointing to the same first entity. There are also some simple properties in both of them.
If, instead, I try to generate the dll statements, they're generated correctly:
[hibernatetool] create table Principal (id int8 not null, propA varchar(255), propB int4, primary key (id));
[hibernatetool] create table Satellite (principal_id int8 not null, propC int4, primary key (principal_id));
[hibernatetool] alter table Satellite add constraint FK1952E91B3558E23F foreign key (principal_id) references Principal;
[hibernatetool] create sequence hibernate_sequence;
Satellite has a FK to Principal's PK, and that same FK is Satellite's PK.
I attach an example project (without jars), with the sources, build files and the generated code in "gen" directory. The Eclipse launch configuration (.xml.launch) runs the Ant-Task configured by "generate-classes.xml".
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
17 years, 10 months
[Hibernate-JIRA] Created: (HHH-3306) Discusion about hibetnate, struts, spring and database
by Kahovn Nakamura (JIRA)
Discusion about hibetnate, struts, spring and database
------------------------------------------------------
Key: HHH-3306
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3306
Project: Hibernate3
Issue Type: Improvement
Components: query-criteria
Affects Versions: 3.2.1
Environment: tomcat
Reporter: Kahovn Nakamura
Priority: Critical
I using hibetnate , struts, spring with database is oracle 10.2.0. But when excute a statement this below so occur error:
SELECT tmsystem_01.ID as id, tmsystem_01.NAME as name FROM TM.SYSTEM tmsystem_01
But when i repaire this sql below , so no error:
SELECT tmsystem_01.ID as id, tmsystem_01.NAME as name FROM "TM.SYSTEM" tmsystem_01
please give me advance and resolve it.
--
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
17 years, 10 months
[Hibernate-JIRA] Created: (HHH-3304) Where clause causes query to select from sub-class table
by Thom Hehl (JIRA)
Where clause causes query to select from sub-class table
--------------------------------------------------------
Key: HHH-3304
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3304
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.6
Environment: Informix IDS 9
Reporter: Thom Hehl
If I have two classes:
public class ExcuseCode extends Code{
/**
* flag for no
*/
public static final String FLAG_NO = "N";
/**
* flag for yes
*/
public static final String FLAG_YES = "Y";
/**
* Participant must be within a certain number of miles
*/
public static final String TRIGGER_MILEAGE = "MILEAGE";
/**
* Participant must be too old
*/
public static final String TRIGGER_OVERAGE = "OVERAGE";
private static final long serialVersionUID = 1L;
@SuppressWarnings("all")
private static Log _log = LogFactory.getLog(ExcuseCode.class.getName());
private String additionalMessage;
private String autoFlag;
private String ejVisible;
private boolean remarksRequired;
private String trigger;
/**
* no-arg constructor
*/
public ExcuseCode(){
}
/**
* constructor with only the code character
*/
public ExcuseCode(char code){
setCodeChar(code);
setAdditionalMessage("default postponement");
setAutomatic(false);
setDescription("default postponement");
setShortText("default postponement");
}
/**
* copy constructor
*/
public ExcuseCode(ExcuseCode excuseCode){
setCodeChar(excuseCode.getCodeChar());
setAdditionalMessage(excuseCode.getAdditionalMessage());
setAutomatic(false);
setDescription(excuseCode.getDescription());
setShortText(excuseCode.getShortText());
}
/**
* @return the automatic
*/
public boolean isAutomatic() {
return getAutoFlag().equals(FLAG_YES);
}
/**
* @param automatic the automatic to set
*/
public void setAutomatic(boolean automatic) {
if(automatic){
setAutoFlag(FLAG_YES);
}
else{
setAutoFlag(FLAG_NO);
}
}
/**
* @return the visible
*/
public boolean isVisible() {
return getEjVisible().equals(FLAG_YES);
}
/**
* @param visible the visible to set
*/
public void setVisible(boolean visible) {
if(visible){
setEjVisible(FLAG_YES);
}
else{
setEjVisible(FLAG_NO);
}
}
/**
* A special code to indicate additional processing. Use this instead of
* code to key custom processing.
* @return the trigger
*/
public String getTrigger() {
return trigger;
}
/**
* A special code to indicate additional processing. Use this instead of
* code to key custom processing.
* @param trigger the trigger to set
*/
public void setTrigger(String trigger) {
this.trigger = trigger;
}
/**
* Upon selection, display this additional message
* @return the additionalMessage
*/
public String getAdditionalMessage() {
return additionalMessage;
}
/**
* Upon selection, display this additional message
* @param additionalMessage the additionalMessage to set
*/
public void setAdditionalMessage(String additionalMessage) {
this.additionalMessage = additionalMessage;
}
/**
* @return the remarksRequired
*/
public boolean isRemarksRequired() {
return remarksRequired;
}
/**
* @param remarksRequired the remarksRequired to set
*/
public void setRemarksRequired(boolean remarksRequired) {
this.remarksRequired = remarksRequired;
}
/**
* @return the ejVisible
*/
public String getEjVisible() {
return ejVisible;
}
/**
* @param ejVisible the ejVisible to set
*/
public void setEjVisible(String ejVisible) {
this.ejVisible = ejVisible;
}
/**
* @return the autoFlag
*/
public String getAutoFlag() {
return autoFlag;
}
/**
* @param autoFlag the autoFlag to set
*/
public void setAutoFlag(String autoFlag) {
this.autoFlag = autoFlag;
}
and
public class DisqualificationCode extends ExcuseCode {
private static final long serialVersionUID = 1L;
/**
* Participant must be too old
*/
public static final String TRIGGER_OVERAGE = "OVERAGE";
/**
* Participant must be too young
*/
public static final String TRIGGER_UNDERAGE = "UNDERAGE";
/**
* Participant must be unemployed
*/
public static final String TRIGGER_UNEMPLOYED = "UNEMPLOYED";
/**
* no-arg constructor
*/
public DisqualificationCode(){
super();
}
/**
* create from a code
* @param code the code for this disqualification code
*/
public DisqualificationCode(char code){
super(code);
}
/**
* copy constructor
* @param disqCode the disqualification code being copied
*/
public DisqualificationCode(DisqualificationCode disqCode){
super(disqCode);
}
/**
* constructor from super classs
* @param exCode the excuse code being copied
*/
public DisqualificationCode(ExcuseCode exCode){
super(exCode);
}
and mapping files to match:
<hibernate-mapping>
<class name="xxx.bo.ExcuseCode" table="EXC_CODE">
<id name="codeChar" column="EXC_CODE">
<generator class="assigned"/>
</id>
<property name="description"/>
<property name="ejVisible" column="EJ_VISIBLE"/>
<property name="autoFlag" column="AUTO"/>
</class>
</hibernate-mapping>
<hibernate-mapping>
<class name="com.acs.gs.juror.bo.DisqualificationCode" table="DIS_CODE">
<id name="code" column="DISQ_CODE" type="string">
<generator class="assigned"/>
</id>
<property name="description" type="string"/>
</class>
</hibernate-mapping>
and then run a query (using Spring):
HibernateTemplate ht = getHibernateTemplate();
if(ht==null){
String msg="HibernateTemplate is null.";
_log.error(msg);
throw new IllegalStateException(msg);
}
@SuppressWarnings("unchecked")
List<ExcuseCode> excuseCodes = ht.find(
"from ExcuseCode excusecode where ejVisible='Y' order by excusecode.description asc");
_log.debug("ExcuseCodes:" + excuseCodes);
return excuseCodes;
I get this error:
SEVERE: Column not found: EJVISIBLE in statement [select disqualifi0_.DISQ_CODE as DISQ1_5_, disqualifi0_.description as descript2_5_ from DIS_CODE disqualifi0_ where ejVisible='Y' order by disqualifi0_.description asc]
Note that I'm running select ExcuseCode, but hibernate is building a query for the DIS_CODE table which is the subclass of ExcuseCode.
Thanks.
and
--
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
17 years, 10 months
[Hibernate-JIRA] Closed: (HHH-1786) JTASessionContext.CleanupSynch does not remove sessions from currentSessionMap
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1786?page=c... ]
Steve Ebersole closed HHH-1786.
-------------------------------
Resolution: Fixed
Fix Version/s: (was: 3.3.0.CR1)
3.3.0.CR2
> JTASessionContext.CleanupSynch does not remove sessions from currentSessionMap
> ------------------------------------------------------------------------------
>
> Key: HHH-1786
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1786
> Project: Hibernate3
> Issue Type: Improvement
> Affects Versions: 3.1.2
> Environment: IBM WebSphere 6.0.2.7, Hibernate CVS snapshot from 2006-02-24
> Reporter: Tomi Szabo
> Assignee: Steve Ebersole
> Fix For: 3.3.0.CR2
>
> Attachments: JTASessionContext.java, screenshot-1.jpg, screenshot-2.jpg, WebSphereExtendedJTATransactionLookup.java, WebSphereExtendedJTATransactionLookup.patch.txt
>
>
> We are using JTASessionContext, CMTTransaction and WebSphereExtendedJTATransactionLookup. We have experienced some memmory leak problems and after closer inspection we have found that Hibernate sessions are not removed from currentSessionMap inside JTASessionContext.
> Method JTASessionContext.CleanupSynch.afterCompletion() is called as expected but code "context.currentSessionMap.remove( txn );" does not remove session from Map because of key's hashcode has changed. This is due to fact that com.ibm.websphere.jtaextensions.ExtendedJTATransaction.hashCode is actually ID of underlaying transaction. But if it comes to the afterCompletion method in CleanupSynch the underlaying transaction is already closed. Closed transaction has ID 0 (default value) and it is different from ID under which the Hibernate session was previously inserted into Map.
> Possible patch is in attachements.
--
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
17 years, 10 months