[Hibernate-JIRA] Created: (HHH-5325) Minor issues in test suite and suggestions for improvements
by Fred Toussi (JIRA)
Minor issues in test suite and suggestions for improvements
-----------------------------------------------------------
Key: HHH-5325
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5325
Project: Hibernate Core
Issue Type: Improvement
Components: testsuite
Affects Versions: 3.5.3
Environment: tested with HSQLDB 2.0
Reporter: Fred Toussi
Priority: Minor
hql:ASTParserLoadingTest : testComponentNullnessChecks()
String query = getDialect() instanceof DB2Dialect ?
"from Human where cast(? as string) is null" :
"from Human where ? is null"
The cast should be made by default. DB2 is highly SQL Standard conformant and displays the correct behaviour.
(SQL Standard Part 3: Call-Level Interface (SQL/CLI)) Others may "invent" a character type for the dynamic param.
-----------------------
legacy:FooBarTest : testFindByCriteria()
if(!(getDialect() instanceof TimesTenDialect)) {
list = s.createCriteria(Foo.class).setMaxResults(0).list();
assertTrue( list.size()==0 );
}
The test produces the equivalent to SQL statements with "FETCH 0 ROWS ONLY" or "LIMIT 0" etc. This is explicitly stated to cause a data exception according to SQL:2008. The row count must be at least 1.
-----------------------
org.hibernate.test.hql : Animal.hbm.xml
This snippet is used in several tests. Search for "centimeters".
<property name="heightInches">
<column name="height_centimeters" not-null="true"
read="height_centimeters / 2.54"
write="? * 2.54"/>
</property>
The target SQL column type is created as DOUBLE in most dialects. The dynamic variable in "? * 2.54" first resolves to DECIMAL because the "declared type" of the numeric literal is DECIMAL. It would be better to use "? * 2.54E0" as a hint to use DOUBLE.
--
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
[Hibernate-JIRA] Created: (HHH-5378) 3.5.3: @OrderColumn not updated when inserting
by Jürgen Zimmermann (JIRA)
3.5.3: @OrderColumn not updated when inserting
----------------------------------------------
Key: HHH-5378
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5378
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.5.3
Environment: JDK 1.6_20, Hibernate 3.5.3, Spring 3.0.3, Tomcat 7.0.0-beta
Reporter: Jürgen Zimmermann
I'm having an abstract entity class "AbstractKunde" und a derived class "Privatkunde" (see below). AbstractKunde references one-to-many the entity class "Bestellung" and also defines @OrderColumn.
However, when I create a new Bestellung object, then the column for @OrderColumn isn't updated.
@Entity
@Table(name = "kunde")
@Inheritance
@DiscriminatorColumn(name = "art", length = 1)
...
public abstract class AbstractKunde implements java.io.Serializable {
...
@OneToMany(mappedBy = "kunde")
@OrderColumn(name = "idx")
private List<Bestellung> bestellungen;
...
}
@Entity
@Table(name = "bestellung")
...
public class Bestellung implements java.io.Serializable {
...
@ManyToOne(optional = false)
@JoinColumn(name = "kunde_fk")
@NotNull(message = "{bestellverwaltung.bestellung.kunde.notNull}")
private AbstractKunde kunde;
...
}
@Entity
@DiscriminatorValue("P")
public class Privatkunde extends AbstractKunde {
...
}
--
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
[Hibernate-JIRA] Created: (HHH-5495) Unknown mappedBy using @Id @OneToOne
by Alfio (JIRA)
Unknown mappedBy using @Id @OneToOne
------------------------------------
Key: HHH-5495
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5495
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.0.Beta3, 3.5.0-Final
Environment: Hibernate 3.5 and 3.6.0-Beta3
Glassfish v3.0.1
Reporter: Alfio
Attachments: test.zip
This example should work according to JSR 317, Section 2.4.1.3, Example 4 Case(a):
@Entity
public class Person {
@Id
private String ssn;
@Column( nullable = false )
private String name;
@Column( nullable = false )
private String surname;
@OneToOne( mappedBy = "person" )
private PersonDetail personDetail;
... getters and setters ...
}
@Entity
public class PersonDetail {
@Id
@OneToOne
private Person person;
@Column( nullable = true )
private int age;
@Column( nullable = true )
private String city;
... getters and setters ...
}
----
During deploy the following error is shown:
Exception while preparing the app org.hibernate.AnnotationException: Unknown mappedBy in: test.Person.personDetail, referenced property unknown: test.PersonDetail.person
at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:159)
at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1754)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1461)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1413)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1453)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1081)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:677)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:181)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:96)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:121)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:644)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:296)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
---
It works well if I use MapsId (following example 4 case b in JSR 317)
@Entity
public class PersonDetail {
@Id
private String ssnPK;
@MapsId
@OneToOne
private Person person;
...
--
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
[Hibernate-JIRA] Created: (HHH-5390) Index column on inverse List should throw a warning
by Chris Bredesen (JIRA)
Index column on inverse List should throw a warning
---------------------------------------------------
Key: HHH-5390
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5390
Project: Hibernate Core
Issue Type: Improvement
Components: annotations
Affects Versions: 3.5.3
Reporter: Chris Bredesen
The manual correctly warns against trying to map an indexed inverse collection on a List. However, a configuration containing this invalid mapping builds successfully but causes null values to be inserted for the index column.
Hibernate should be helpful and, if possible, throw a warning to the user (perhaps an error?) that explains the invalid combination. Here is an example that would run but produce invalid results:
@Entity
public class Parent {
@OneToMany(mappedBy="parent")
@OrderColumn(name="order")
private List<Child> children;
}
@Entity
public class Child {
@ManyToOne
private Parent parent;
}
The above is a typical one to many with the addition of @OrderColumn. Because Child owns the relationship, the index column is lost/ignored. Hibernate should warn about 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
[Hibernate-JIRA] Created: (HHH-3551) Boolean substitution in informix
by Rouvignac (JIRA)
Boolean substitution in informix
--------------------------------
Key: HHH-3551
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3551
Project: Hibernate Core
Issue Type: Bug
Components: query-sql
Affects Versions: 3.3.1
Environment: Hibernate 3.2
Informix 9.40
Reporter: Rouvignac
HQL Query :
select order from Order order where order.printed = ?
Parameter :
true, false, Boolean.TRUE or Boolean.FALSE
When the request is executed we get the following error :
SQLSTATE: IX000
SQL CODE: -674
674: Routine (equal) can not be resolved.
If as parameter we use "t" ot "f" everything works fine but it will not work with other DB.
As a workaround we can use :
property name="hibernate.query.substitutions">true t, false f</property>
I investigated in Dialects :
Dialect.java
public String toBooleanValueString(boolean bool) {
return bool ? "1" : "0";
}
PostgreSQLDialect.java
public String toBooleanValueString(boolean bool) {
return bool ? "true" : "false";
}
InformixDialect.java uses Dialect.java toBooleanValueString method.
In my mind toBooleanValueString should be added to InformixDialect.java as follow :
public String toBooleanValueString(boolean bool) {
return bool ? "t" : "f";
}
--
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