[Hibernate-JIRA] Created: (HV-182) Error when using composite constraints (wrong messages and stack traces)
by Hardy Ferentschik (JIRA)
Error when using composite constraints (wrong messages and stack traces)
------------------------------------------------------------------------
Key: HV-182
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-182
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Reporter: Hardy Ferentschik
Fix For: 4.0.0.Beta2
Attachments: bv_issue.zip
i'm using the current snapshot of hibernate validator v4.
constellation:
composite constraint + @ReportAsSingleViolation
on part of the composition is:
@Size(min = 1, max = 10)
the message of the composite constraint:
the following sometimes leads to a wrong text:
String message() default "my msg -- min: {min} max: {max}";
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
if i run the test-case multiple times (sometimes really really often) the following stacktrace shows up:
java.lang.AssertionError: expected:<interface javax.validation.constraints.NotNull> but was:<interface javax.validation.constraints.Size>
at org.junit.Assert.fail(Assert.java:58)
at org.junit.Assert.failNotEquals(Assert.java:259)
at org.junit.Assert.assertEquals(Assert.java:80)
at org.junit.Assert.assertEquals(Assert.java:88)
at test.CompositeConstraintTest.invalidNickName(CompositeConstraintTest.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at com.intellij.rt.junit4.Junit4ClassSuite.run(Junit4ClassSuite.java:99)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
the bad thing is - i cannot always reproduce it - i run some junit test-cases - sometimes the interpolated message is ok and one test-run later (without source changes) it's something like that:
my msg - min: my msg - min: {min} max: {max} max: my msg - min: {min} max: {max}
--
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, 11 months
[Hibernate-JIRA] Créée: (HHH-2086) Patch for bug HHH-2076 and to be able to use <formula> in <key> for <one-to-many>
by Xavier Brénuchon (JIRA)
Patch for bug HHH-2076 and to be able to use <formula> in <key> for <one-to-many>
---------------------------------------------------------------------------------
Key: HHH-2086
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2086
Project: Hibernate3
Type: Patch
Components: core
Versions: 3.2.0.cr4
Reporter: Xavier Brénuchon
Attachments: formula_one_to_many.patch
Hello,
There is a patch to correct bug HHH-2076 and make an improvement for HHH-944.
In fact, theses 2 cases are linked. They need, amongst other things, a formula in the right part of outer join.
This patch is simple but many class concerns (to propagate formula templates).
About formula in one-to-many :
You must have at least a column (not only formula), because it's not possible to have an Update order without at least a column. If it is the case, hibernate patch will raise an MappingException rightly.
This patch add two TestCase :
org.hibernate.test.onetoone.bidirectionnalformula. OneToOneBidirectionalFormulaTest
org.hibernate.test.onetomany.formula. OneToManyFormulaTest
Would it be possible to integrate this patch into Hibernate 3.2 ?
--
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, 11 months
[Hibernate-JIRA] Commented: (HHH-1643) Sub-query as function parameter - either sub-query is missed from SQL or NullPointerException raised
by Manuel Dominguez Sarmiento (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1643?page=c... ]
Manuel Dominguez Sarmiento commented on HHH-1643:
-------------------------------------------------
This hasn't been been fixed in 3.3.2 which has been recently released. Any chance it might be incorporated into 3.5? The patch works fine. Patching this in the official distribution would allow us to avoid having to manually build Hibernate on each release, as well as the obvious benefit to anyone else impacted by this limitation. It sounds dumb but building Hibernate from scratch is not all that straightforward and even if you know how to go about it takes quite a while.
> Sub-query as function parameter - either sub-query is missed from SQL or NullPointerException raised
> ----------------------------------------------------------------------------------------------------
>
> Key: HHH-1643
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1643
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.1.2, 3.1.3
> Environment: Hibernate 3.1.2 MS SQL Server 2K
> Reporter: Andy Shelton
> Attachments: hql-sql.patch
>
>
> The HQL grammar HQL (hql.g) allows expressions and sub-queries as parameters to functions, however the SQL Tree Transform grammar (hql-sql.g) does not, it only allows expressions. This means if you pass a sub-query as a parameter to something like "cast" for example, you will get a NullPointerException. In other cases, typically the sub-query is missed out of the resulting SQL. This is easily remedied by changing the first line of the definition of functionCall within hql-sql.g from:
> functionCall
> : #(METHOD_CALL {inFunctionCall=true;} pathAsIdent ( #(EXPR_LIST (expr)* ) )? )
> to:
> functionCall
> : #(METHOD_CALL {inFunctionCall=true;} pathAsIdent ( #(EXPR_LIST (exprOrSubquery)* ) )? )
> This modification has been tested against all the existing UnitTests in Hibernate 3.1.2 and does not cause any problems.
> I've included a patch for this.
--
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, 11 months
[Hibernate-JIRA] Commented: (HHH-1909) Incomplete insert and update using <<insert="false" update="false">>
by Maverick (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1909?page=c... ]
Maverick commented on HHH-1909:
-------------------------------
I had the same problem. I solved it by adding the following code to each line that reported the error:
insertable=false, updatable=false
hope this helps
Maverick
> 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
> 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, 11 months