[Hibernate-JIRA] Created: (HV-71) DigitsValidator and EANValidator are not serializable.
by benoit heinrich (JIRA)
DigitsValidator and EANValidator are not serializable.
------------------------------------------------------
Key: HV-71
URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-71
Project: Hibernate Validator
Issue Type: Bug
Components: validators
Affects Versions: 3.1.0.GA
Reporter: benoit heinrich
Hi all,
If you try to serialize a DigitsValidator and EANValidator validator class instance, then you get a nice:
java.io.NotSerializableException: org.hibernate.validator.DigitsValidator
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
An easy way to reproduce it is to run the following unit test:
public class ValidatorTest {
@Test(dataProvider = "getValidators")
public void testValidatorSerialization(Validator<?> validator) throws IOException {
OutputStream os = new ByteArrayOutputStream();
new ObjectOutputStream(os).writeObject(validator);
}
@DataProvider(name = "getValidators")
public Object[][] getValidators() {
return new Object[][] {
{new AssertFalseValidator()},
{new AssertTrueValidator()},
{new CreditCardNumberValidator()},
{new DigitsValidator()},
{new EANValidator()},
{new EmailValidator()},
{new FutureValidator()},
{new LengthValidator()},
{new MaxValidator()},
{new MinValidator()},
{new NotEmptyValidator()},
{new NotNullValidator()},
{new PastValidator()},
{new PatternValidator()},
{new RangeValidator()},
{new SizeValidator()},
};
}
}
To fix it you should simply make the two classes implementing Serializable.
--
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
16 years, 3 months
[Hibernate-JIRA] Created: (HBX-1089) Relationships are not generated by rev.eng. from Derby database
by Jan Horvath (JIRA)
Relationships are not generated by rev.eng. from Derby database
---------------------------------------------------------------
Key: HBX-1089
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1089
Project: Hibernate Tools
Issue Type: Bug
Components: ant
Affects Versions: 3.2.1
Environment: Apache Derby Network Server - 10.2.2.1
Hibernate Tools 3.2.2.GA
Hibernate 3.2.5
Reporter: Jan Horvath
Attachments: stacktrace.txt
I'm trying to generate HBMs using rev.eng. HBMs are generated correctly except there are relationships missing.
While the task is running SqlException is logged (stacktrace attached)
steps to reproduce:
-create two tables with 1:M relation
CREATE TABLE DOG (ID INT PRIMARY KEY, NAME VARCHAR(64), BREED_ID INT);
CREATE TABLE BREED (ID INT PRIMARY KEY, NAME VARCHAR(64), COLOR VARCHAR(32));
ALTER TABLE DOG ADD CONSTRAINT BREED_FK FOREIGN KEY (BREED_ID) REFERENCES BREED;
-run hibernate rev. eng.
<hibernatetool destdir="src/generated" >
<jdbcconfiguration
configurationfile="src/java/hibernate.cfg.xml"
packagename="test"/>
<hbm2hbmxml/>
<hbm2java/>
</hibernatetool>
--
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
16 years, 3 months