Permalink
Browse files

CoreFixy: Lookup not only for classes in package

  • Loading branch information...
1 parent 0263bc0 commit 0bd113d6f1c5a47e5945e83a2a4264e32d83e356 @andrey-fomin andrey-fomin committed Apr 10, 2012
@@ -78,10 +78,20 @@ public CoreFixy(Persister persister) {
@Override
protected Class<?> getClassForName(String name) throws ClassNotFoundException {
if(!Strings.isNullOrEmpty(packageName)) {
- return super.getClassForName(packageName + "." + name);
- } else {
+ try {
+ return super.getClassForName(packageName + "." + name);
+ } catch (ClassNotFoundException ignored) { }
+ }
+ ClassNotFoundException exceptionToThrow;
+ try {
return super.getClassForName(name);
+ } catch (ClassNotFoundException e) {
+ exceptionToThrow = e;
}
+ try {
+ return super.getClassForName("java.lang." + name);
+ } catch (ClassNotFoundException ignored) { }
+ throw exceptionToThrow;
}
@Override
@@ -6,6 +6,7 @@
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
+import java.sql.Date;
@Entity
public class Pet {
@@ -20,6 +21,8 @@
Long price;
+ Date birthDate;
+
@OneToOne(mappedBy = "pet")
Order order;
@@ -56,6 +59,14 @@ public void setPrice(Long price) {
this.price = price;
}
+ public Date getBirthDate() {
+ return birthDate;
+ }
+
+ public void setBirthDate(Date birthDate) {
+ this.birthDate = birthDate;
+ }
+
public Order getOrder() {
return order;
}
@@ -3,4 +3,6 @@
- Pet(fido):
name: Fido
- type: PetType(dog)
+ type: PetType(dog)
+ price: !!Long 100
+ birthDate: !!java.sql.Date 2001-09-09T01:46:40Z

0 comments on commit 0bd113d

Please sign in to comment.