[Hibernate-JIRA] Created: (HBX-876) support configurable strategy for "format HQL" function in HQL editor
by Joseph Marques (JIRA)
support configurable strategy for "format HQL" function in HQL editor
---------------------------------------------------------------------
Key: HBX-876
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-876
Project: Hibernate Tools
Type: New Feature
Versions: 3.2beta8
Reporter: Joseph Marques
use the HQL editor to mock up new JPQL statements, and then copy and paste them from there over into some @NamedQuery definition on the appropriate class. Persons responsible for maintaining multiple back-end codebases, or those motivated individuals that have personal projects on the side, might have to adhere to multiple code conventions across these different bases. In order to facilitate more control in this arena, which I believe would also add significant value to the tool, the HQL editor could support formatting statements based on a configurable strategy. Here are some suggestions:
1) Alias with "AS" - yes / no - determines whether all aliases should have "AS" inserted before it, if missing, or not
2) Captialization - ALLCAPS / allsmall / Firstletter
3) Relationship syntax - legacy / modern - determine whether inner joins shoudl be "IN (obj.relationships) rel" / "INNER JOIN obj.relationships rel
4) Explicit inner/outer - yes/no - determine whether the optional "inner" and "outer" keywords should be part of the formatted hql/jpql
But that's just to start. In an ideal world, every part of the formatting would be configurable (similar to how Eclipse offers extermely flexible code formatting) including:
* before / after / or both before & after what hql/jpql keywords the statement should break to the next line
* whether aliases should be automatically introduced (when they don't exist) for better readability
--
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, 11 months
[Hibernate-JIRA] Updated: (HHH-1720) Incorrect Results from multi-valued query containing one-to-one
by Mike Ringrose (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1720?page=all ]
Mike Ringrose updated HHH-1720:
-------------------------------
Attachment: queryloader_patch.txt
This also fixes this issue by using the supplied loadable objects when creating a return row of values. Sorry for posting two patches, but both alleviate this issue; hopefully they are sufficient.
> Incorrect Results from multi-valued query containing one-to-one
> ---------------------------------------------------------------
>
> Key: HHH-1720
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1720
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Versions: 3.1.3
> Environment: Hibernate 3.1.3, Oracle 10
> Reporter: Mike Ringrose
> Attachments: Record.hbm.xml, RecordRegistry.hbm.xml, dotnode_patch.txt, queryloader_patch.txt
>
>
> The Query below used to work correctly when using the classic query translator; however, no long returns the correct results with the ast query translator. WIth the ast query translator, the third result from the select, which is a one-to-one, always returns null even when the value exists.
> SELECT t.nameFirst, t.nameLast, t.registryRecord FROM Record t WHERE t.recordId = ?").setLong(0, 1);
> Running the query below with the ast query translator, works fine and always returns the correct results, that's why I beleive the problem to be only with multi-valued queries.
> SELECT t.registryRecord FROM Record t WHERE t.recordId = ?").setLong(0, 1);
> The code between session open and close is below:
> return (Object[])session.createQuery("SELECT t.recordId, t.registryRecord FROM com.imsweb.seerdms.shared.entity.Record t WHERE t.recordId = ?").setLong(0, 1).uniqueResult();
--
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, 11 months
[Hibernate-JIRA] Updated: (HHH-1720) Incorrect Results from multi-valued query containing one-to-one
by Mike Ringrose (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1720?page=all ]
Mike Ringrose updated HHH-1720:
-------------------------------
Attachment: dotnode_patch.txt
This came up again for the project that I'm working on. The is a small patch that simply checks if a OneToOneType is apart of the select clause and if so, it changes it to a ManyToOneType so that it will load properly
> Incorrect Results from multi-valued query containing one-to-one
> ---------------------------------------------------------------
>
> Key: HHH-1720
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1720
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Versions: 3.1.3
> Environment: Hibernate 3.1.3, Oracle 10
> Reporter: Mike Ringrose
> Attachments: Record.hbm.xml, RecordRegistry.hbm.xml, dotnode_patch.txt
>
>
> The Query below used to work correctly when using the classic query translator; however, no long returns the correct results with the ast query translator. WIth the ast query translator, the third result from the select, which is a one-to-one, always returns null even when the value exists.
> SELECT t.nameFirst, t.nameLast, t.registryRecord FROM Record t WHERE t.recordId = ?").setLong(0, 1);
> Running the query below with the ast query translator, works fine and always returns the correct results, that's why I beleive the problem to be only with multi-valued queries.
> SELECT t.registryRecord FROM Record t WHERE t.recordId = ?").setLong(0, 1);
> The code between session open and close is below:
> return (Object[])session.createQuery("SELECT t.recordId, t.registryRecord FROM com.imsweb.seerdms.shared.entity.Record t WHERE t.recordId = ?").setLong(0, 1).uniqueResult();
--
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, 11 months
[Hibernate-JIRA] Commented: (HHH-1657) hql update generate wrong sql with joined subclass hierarcy
by Erwin Bolwidt (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657?page=c... ]
Erwin Bolwidt commented on HHH-1657:
------------------------------------
Some more detail. Say there are two classes:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class A {
private Long id;
// getter and setter
}
@Entity
public class B extends A {
private String name;
// getter and setter
}
This bulk update query will fail:
UPDATE B SET name = 'foobar' WHERE id = ?
with the message "ERROR: column reference "id" is ambiguous" (on Postgresql but the error is not dialect-specific as far as I can see)
The sql that it fails on would be:
insert into HT_b select b0_.id as id from b b0_ inner join a b0_1_ on b0_.id=b0_1_.id where id=?
the last part should have been "where b0_.id = ?
"
> hql update generate wrong sql with joined subclass hierarcy
> -----------------------------------------------------------
>
> Key: HHH-1657
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Environment: Hibernate 3.2.0cr1, Hibernate 3.1.3
> Reporter: Alexey Romanchuk
> Priority: Critical
>
>
> Let suppose that we have two joined subclass entities: Parent (id PK) and Child (id PK) that mapped with joined subclass method.
> When I try to update Child by id with hql:
> update Child c set c.field = 'value' where c.id = 1234
> hibernate generates joined tables like
> insert into HT_parent select child0_.id as id from child child0_ inner join parent child0_1_ on child0_.id=child0_1_.id wher id in = 1234
> look at last condition. hibernate use id WITH OUT tables alias that cause sql exception: column reference "id" is ambiguous
--
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, 11 months
[Hibernate-JIRA] Created: (HBX-872) Pojo generation can lead to invalid property name.
by Alban Soupper (JIRA)
Pojo generation can lead to invalid property name.
--------------------------------------------------
Key: HBX-872
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-872
Project: Hibernate Tools
Type: Bug
Components: reverse-engineer
Versions: 3.2beta8
Environment: Eclipse 3.2.1, JBoss IDE 2.0 beta
Reporter: Alban Soupper
The generation of the property name for a "foreignKeyToCollectionName" is not check against java reserved keywords.
eg: my table is "THI" (for Third) and the resulting property is "this"! (I know... I'm a looser ;)
Solution? :
the method "foreignKeyToCollectionName" in DefaultReverseEngineeringStrategy should be changed to
public String foreignKeyToCollectionName(String keyname, TableIdentifier fromTable, List fromColumns, TableIdentifier referencedTable, List referencedColumns, boolean uniqueReference)
{
String propertyName = Introspector.decapitalize(StringHelper.unqualify(tableToClassName(fromTable)));
propertyName = pluralize(propertyName);
if(!uniqueReference)
if(fromColumns != null && fromColumns.size() == 1)
{
String columnName = ((Column)fromColumns.get(0)).getName();
propertyName = propertyName + "For" + toUpperCamelCase(columnName);
} else
{
propertyName = propertyName + "For" + toUpperCamelCase(keyname);
}
return keywordCheck(propertyName);
-----------------------------------------
}
--
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, 11 months
[Hibernate-JIRA] Created: (EJB-260) OneToMany relationship not persiting merges
by Chadwick Baatz (JIRA)
OneToMany relationship not persiting merges
-------------------------------------------
Key: EJB-260
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-260
Project: Hibernate Entity Manager
Type: Bug
Versions: 3.2.1
Environment: MySQL 5.0x
Reporter: Chadwick Baatz
Priority: Blocker
Attachments: TestProject.zip
I am having problems with the merging of a detached object that has changed. The unidirectional OneToMany relationship is being updated in the Hibernate Context, but that update is not being persisted to the database. I've been able to prove that the Hibernate layer works correctly when either:
1. The object is not detached and I perform a persist
2. The object is detached I perform a merge before any changes, then persist after all changes have been made to the object.
However, if I have a detached object with modifications to the manged one and I perform a merge those changes are done to the managed object in the Hibernate Context, but the database statement is never fired to make the change in the database. Worse yet, any changes merged in this way are not updated on subsequent persist calls.
I've attached a sample project with test code that you can use to recreate the problem. You the SQL statements below to populate the database and you'll have to set up the connection in the persistence.xml file.
SQL Statements:
Create table customer (
customer_id Varchar(100) NOT NULL,
UNIQUE (customer_id),
Primary Key (customer_id)) ENGINE = InnoDB;
Create table customer_group (
customer_group_id Int UNSIGNED NOT NULL AUTO_INCREMENT,
name Varchar(250),
Primary Key (customer_group_id)) ENGINE = InnoDB;
Create table customer_group_customer (
customer_group_id Int UNSIGNED NOT NULL,
customer_id Varchar(100) NOT NULL,
Primary Key (customer_group_id,customer_id)) ENGINE = InnoDB;
Alter table customer_group_customer add Foreign Key (customer_id) references customer (customer_id) on delete restrict on update restrict;
Alter table customer_group_customer add Foreign Key (customer_group_id) references customer_group (customer_group_id) on delete restrict on update restrict;
Create table customer (
customer_id Varchar(100) NOT NULL,
UNIQUE (customer_id),
Primary Key (customer_id)) ENGINE = InnoDB;
Create table customer_group (
customer_group_id Int UNSIGNED NOT NULL AUTO_INCREMENT,
name Varchar(250),
Primary Key (customer_group_id)) ENGINE = InnoDB;
Create table customer_group_customer (
customer_group_id Int UNSIGNED NOT NULL,
customer_id Varchar(100) NOT NULL,
Primary Key (customer_group_id,customer_id)) ENGINE = InnoDB;
Alter table customer_group_customer add Foreign Key (customer_id) references customer (customer_id) on delete restrict on update restrict;
Alter table customer_group_customer add Foreign Key (customer_group_id) references customer_group (customer_group_id) on delete restrict on update restrict;
--
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, 11 months
[Hibernate-JIRA] Created: (EJB-262) hbm.xml mapping errors have no context making it hard to track down the cause
by Max Rydahl Andersen (JIRA)
hbm.xml mapping errors have no context making it hard to track down the cause
-----------------------------------------------------------------------------
Key: EJB-262
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-262
Project: Hibernate Entity Manager
Type: Improvement
Components: EntityManager
Versions: 3.2.1
Reporter: Max Rydahl Andersen
Starting a Ejb3Configuration on e.g. jpwh-essentials lab4 where there is an error in one of the 5 hbm.xml files one get an exception that states:
Caused by: javax.persistence.PersistenceException: org.hibernate.MappingException: invalid mapping
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:247)
... 16 more
Caused by: org.hibernate.MappingException: invalid mapping
at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:672)
at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:920)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:750)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:178)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:235)
... 16 more
Caused by: org.xml.sax.SAXParseException: The content of element type "class" must match "(meta*,subselect?,cache?,synchronize*,comment?,tuplizer*,(id|composite-id),discriminator?,natural-id?,(version|timestamp)?,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,((join*,subclass*)|joined-subclass*|union-subclass*),loader?,sql-insert?,sql-update?,sql-delete?,filter*,resultset*,(query|sql-query)*)".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValidator.java:2048)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.java:932)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:668)
... 20 more
When entitymanager parses hbm.xml it apparently create alot of inputstreams and asks hibernate to parse them....the entitymanger should keep track of where those files come from and throw an exception stating which file/resource actually fails.
--
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, 11 months