Reputation: 1724
I'm a java developer. I'm using hibernate 4.2.21. I have an Entity as follow:
@Entity
public class MyEntity {
@Id
@GeneratedValue
private id;
}
I want to admin system, have some custom fields.
What is a "Custom Field"?
What is a custom field and how the end user benefit from this? A custom field is an attribute of an object which has not been created by the system developer at the development stage but that has been added by the system user into the object when actually using the system not introducing any changes into the source code of the application.
Let's try to figure out this based on an example of a CRM application. Let's say we have an object "Client". Theoretically this object can have any number of various attributes: several email addresses, many phone numbers, addresses etc. One of these can be used by Sales Department of one company however will be totally ignored by another organization. To enter all possible attributes into the object that may (may not) be used by the end users is wasteful and unjustified.
In this case if would be better to allow the user (or administrator) of the system to create the attributes that are necessary for sales managers in a specific organization. For example, administrator can create an attribute "work phone" if this field is actually required or "home address" and etc. Further these fields can be used in the application for example for filtering and searching of data.
Upvotes: 0
Views: 621
Reputation: 1265
You can have a class which can have two fields. One should be attribute name and other should have attribute value. Every time user wants to add some attribute you should create a new object of this class and have relation with other class.
Upvotes: 1