[Hibernate-JIRA] Created: (BVAL-214) Ability to validate an object and a list of changes
by Emmanuel Bernard (JIRA)
Ability to validate an object and a list of changes
---------------------------------------------------
Key: BVAL-214
URL: http://opensource.atlassian.com/projects/hibernate/browse/BVAL-214
Project: Bean Validation
Issue Type: Improvement
Reporter: Emmanuel Bernard
Pass a list of changes applied to an object graph and validate the object graph had the change been applied.
This is useful for presentation layers like JSF for cross field validations for example.
There are several possibilities to implement that:
1. pass in a Map<String,Object> with the list of changed properties
{code}validator.validateObject(Object model,Map<String,Object> newValues, Class ...profile){code}
2. pass in a set of more typesafe changedset but essentially the same as 1.
{code}changeSet.change("property", value).change("property2", null).remove("collection", index);
validator.validateObject(Object model,ChangeSet changeSet, Class ...profile){code}
3. pass a proxy of the object and apply changes to the proxy. One of the benefits of this approach is that it is transparent to the validator API. The drawback is that the object must be proxyable
{code}User proxiedUser = proxyfier.proxy(user);
proxiedUser.setName("Emmanuel");
proxiedUser.getAddresses().add(address);
validator.validateObject(Object proxiedUser, Class ...profile){code}
More info from Alex
{code} Client side validation already implemented in coming RichFaces 4.0 release, that's not a subject for bean validation. From the JSF side, the cool feature would be object validation that doesn't touch model itself. Currently, we can only validate a single bean attribute aganist new value, that doesn't allow. In richfaces, I do make a 'clone' of target object, update it with new values and perform validation on the cloned object. Would be nice to have something like: validator.validateObject(Object model,Map<String,Object> newValues, Class ...profile) that does a similar work.{code}
--
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
12 years, 3 months
[Hibernate-JIRA] Created: (HHH-5376) Tests contain invalid SQL
by Fred Toussi (JIRA)
Tests contain invalid SQL
-------------------------
Key: HHH-5376
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5376
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.x
Environment: Using HSQLDB 2.0.1 and Hibernate trunk (12 July 2010)
Reporter: Fred Toussi
These create table statements declare both primary key and unique constraints on the same set of columns. This is against the SQL standard and will fail with most databases.
public class DerivedIdentitySimpleParentSimpleDepTest extends TestCase {
22:52:06,265 ERROR SchemaExport:386 - Unsuccessful: create table MedicalHistory (lastupdate date, FK varchar(255) not null, primary key (FK), unique (FK))
22:52:06,265 ERROR SchemaExport:387 - a UNIQUE constraint already exists on the set of columns in statement [create table MedicalHistory (lastupdate date, FK varchar(255) not null, primary key (FK), unique (FK))]
public class DerivedIdentityIdClassParentSameIdTypeIdClassDepTest extends TestCase {
public void testOneToOneExplicitJoinColumn() throws Exception {
23:16:18,328 DEBUG SchemaExport:415 -
create table MedicalHistory (
FK1 varchar(255) not null,
FK2 varchar(255) not null,
primary key (FK1, FK2),
unique (FK1, FK2)
)
23:16:18,328 ERROR SchemaExport:386 - Unsuccessful: create table MedicalHistory (FK1 varchar(255) not null, FK2 varchar(255) not null, primary key (FK1, FK2), unique (FK1, FK2))
23:16:18,328 ERROR SchemaExport:387 - a UNIQUE constraint already exists on the set of columns in statement [create table MedicalHistory (FK1 varchar(255) not null, FK2 varchar(255) not null, primary key (FK1, FK2), unique (FK1, FK2))]
--
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
12 years, 4 months
[Hibernate-JIRA] Created: (HHH-4751) Fix for @embeddedid error: Type not supported: org.hibernate.type.ManyToOneType
by David Coleman (JIRA)
Fix for @embeddedid error: Type not supported: org.hibernate.type.ManyToOneType
--------------------------------------------------------------------------------
Key: HHH-4751
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4751
Project: Hibernate Core
Issue Type: Improvement
Components: envers
Reporter: David Coleman
Priority: Minor
Attachments: IDMetadataGenerator_patch.txt
Hi,
After creating hibernate entities from the legacy database with envers hibernate tool, I noticed the following error occurred on creating an audit tables that has an @EmbeddedId attribute (related to ENVERS-76]:
Caused by: org.hibernate.MappingException: Type not supported: org.hibernate.type.ManyToOneType ..
I found out by looking at the source that the reason it failed was that the property type was not an instance of ImmutableType (not mutable); which was true as the embedded id was a combination of an int and a mutable java data object. I switched the mutable java date object to a immutable joda datetime object using the joda date time hibernate user type to fix the immutable problem.
I also patched IdMetadataGenerator locally to the one attached as hibernate usertypes do not implement the ImmutableType interface; using the method 'isMutable()' should be suffice.
Let me know if this is okay so I can submit the patch.
--
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
12 years, 4 months
[Hibernate-JIRA] Created: (HHH-5188) Use provided enum type ordinal/string when reading
by Stefan Larsson (JIRA)
Use provided enum type ordinal/string when reading
--------------------------------------------------
Key: HHH-5188
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5188
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.5.1, 3.5.0-CR-2
Reporter: Stefan Larsson
Priority: Minor
Attachments: EnumType.java-typeSafeNullSafeGet.patch
When Hibernate reads a PostgreSQL enum type using ResultSet.getObject(), the JDBC driver returns a driver-specific PGObject object, which preserves both the value of the enum and its type ordinal/string. Hibernate fails with a ClassCastException when it attempts to cast the PGObject into a String in org.hibernate.type.EnumType.nullSafeGet().
The code in org.hibernate.type.EnumType assumes that ResultSet.getObject() will either return a Number or a String, which is not true for the PostgreSQL driver. IMHO it would be better to let the JDBC driver do the conversion using ResultSet.getInt() or getString() instead.
The attached patch allows JBoss AS 6 M3 (Hibernate 3.5.0-CR-2) to read PostgreSQL enums, using JPA, with a a Java enum annotated as @javax.persistence.Enumerated(javax.persistence.EnumType.STRING).
Also, I believe that perhaps ignoring the given enum type causes Issue HHH-4230, where an ordinal enum was stored in character field. ResultSet.getInteger() might work for that one depending on the JDBC driver.
--
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
12 years, 4 months