[Hibernate-JIRA] Created: (EJB-441) nullable=true is ONLY a hint for schema generation, but Hibernate uses it for validation
by Francisco Peredo (JIRA)
nullable=true is ONLY a hint for schema generation, but Hibernate uses it for validation
----------------------------------------------------------------------------------------
Key: EJB-441
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-441
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.3.2.GA
Reporter: Francisco Peredo
With the following JPA @Entity (note the @Basic(optional=true), @Column(nullable=false) at the getName method):
@Entity
public class Customer {
private Long id;
private String name;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Basic(optional=true)
@Column(nullable=false)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
And then the following test
@Test
public void persistCustomerInTransaction() throws Exception {
factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
EntityManager em = factory.createEntityManager();
em.getTransaction().begin();
Customer customer = new Customer();
em.persist(customer);em.getTransaction().commit();
em.close();
}
What exception should be the root cause of this problem?
According to the spec @Column(nullable=false) is JUST a schema generation hint, and Hibernate should NOT use it for object level validation, so it should crash with a java.sql.SQLException as the root exception, and not with a org.hibernate.PropertyValueException thrown by org.hibernate.engine.Nullability.checkNullability.
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (EJB-384) JPQL Constructor Queries containing Timestamp cause exception
by Bjorn Beskow (JIRA)
JPQL Constructor Queries containing Timestamp cause exception
-------------------------------------------------------------
Key: EJB-384
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-384
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.3.1.GA
Environment: Hibernate 3.3.1.GA, Derby, JDK1.5, Windows.
Reporter: Bjorn Beskow
Priority: Minor
Attachments: hibernate-jpql-timestamp-bug.zip
When a constructor JPQL query projects a Timestamp, it causes an org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor.
For example, given the following Entity:
@Entity
public class Employee {
...
private Timestamp lastUpdatedAsTimestamp;
...
}
and the following Pojo for the constructor query:
public EmployeeDto(String name, Timestamp lastUpdated) {...}
the following query will throw an exception:
String query =
"SELECT new test.dto.EmployeeDtoUsingTimestamp(e.name, e.lastUpdatedAsTimestamp) " +
"FROM Employee e ORDER BY e.name";
List<EmployeeDto> reportList = em.createQuery(query).getResultList();
java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [test.dto.EmployeeDto] [SELECT new test.dto.EmployeeDto(e.name, e.lastUpdated) FROM test.entities.Employee e ORDER BY e.name]
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:601)
at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:96)
at test.ConstructorQueryTest.testEmployeesQuery(ConstructorQueryTest.java:63)
...
This problem has been reported before (see HHH-278), but the workaround is not a portable JPA solution (having the type Timestamp in the Entity and the type Date in the Pojo constructor is not in line with the Spec, and does not work in other JPA implementations).
I have attached a minimal Maven project with a test case which highlights the problem.
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (HBX-951) Folder selection dialog should allow creating a new folder
by Dan Allen (JIRA)
Folder selection dialog should allow creating a new folder
----------------------------------------------------------
Key: HBX-951
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-951
Project: Hibernate Tools
Issue Type: Improvement
Components: eclipse
Affects Versions: 3.2beta9, 3.2beta10
Environment: Eclipse 3.2.2
Hibernate Tools beta10
Reporter: Dan Allen
Attachments: new_folder.png
The folder selection dialog used by the Hibernate Code Generation... definition screen (Main tab, Output directory) does not allow creating new folders. The lack of this feature is very inconvenient.
For instance, if I would like to export my schema to HTML documentation, I go into the tool to setup a new Exporter. But I cannot create a new folder to put the docs. So I have to quit the dialog, go create a new folder using the Eclipse File > New > Folder dialog. Then I have to go back into the tool and configure it to use this folder.
The attached screenshot shows what I am looking for.
--
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
15 years, 2 months
[Hibernate-JIRA] Created: (HHH-2897) Adding support for use of sequence objects in DB2 V8 OS390
by Tobias Sternvik (JIRA)
Adding support for use of sequence objects in DB2 V8 OS390
----------------------------------------------------------
Key: HHH-2897
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2897
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.5
Environment: Hibernate Core 3.2.5ga, DB2 UDB V8 OS390 (Z/OS)
Reporter: Tobias Sternvik
Attachments: DB2390Dialect.java
Since version 8 of DB2 sequence objects are supported on the OS390 platform. But, the syntax for use of sequences varies between OS390 platform and the "rest".
For retreival of next value in DB2 OS390 the syntax is "select nextval for <theSequenceName> from sysibm.sysdummy1" while in the "rest" it is "values nextval for <theSequenceName>". There migt be the case that within AS/400 environment the syntax is imilar to OS390, but I have not verified this.
Also other differences exists..
I've included a enhanced verion of DB2390Dialect.java that has been proven to work in DB2 mainframe environment.
--
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
15 years, 2 months