[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1987?page=c...
]
Ali El Gamal commented on HHH-1987:
-----------------------------------
Thanks for your comment,
I needed to subclass from hibernate types to make hibernate look at the properties as if
they were in the same class not as a map so when it updates the database it adds them to
the table of the entity not creating another table for the custom fields.
If I put these properties in the XML as a map or something like that I'll have 2
problems:
1- A big performance overhead caused from querying the properties for each entity.
2- There will be no type checking. All properties will be strings no matter what are the
types that the user needs
Any comments are welcome.
Thanks,
Ali El Gamal
Custom Fields Support for Hibernate
-----------------------------------
Key: HHH-1987
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1987
Project: Hibernate3
Type: New Feature
Reporter: Ali El Gamal
Priority: Minor
Attachments: CustomFields.zip
What is it?
=======
Custom Fields Support means the ability to add custom fields to existing hibernate
entities in runtime without modifying .hbm files or even recompilling the classes.
Problem Example:
=============
Assume an enterprise application that contains information about a company's
customers. When the enterprise application was developed, the communication between the
company and its customers was through phone calls. As the company become larger and is now
making business overseas, they now have customers outside their country and some business
is now done through emails. Unfortunately, the old enterprise application that the
company was using doesn't support "Custom Fields" so, they had to call back
the software company which has developed this application in order to request these new
updates in their data model.
Scenario if "Custom Fields" was supported:
=============================
When any enterprise that is using an application that support "Custom Fields"
needs to add attributes for their existing entities, they will just need to open the
"Settings" page of their application and add these new fields to existing entity
then they restart the application. The new fields are now ready to use!
How to Design an Application with "Custom Fields" support?
========================================
1- All Hibernate Entities that will need to have "Custom Fields" supported will
need to implement an interface called "ExtensibleEntity" or they can inherit
from "DefaultExtensibleEntity"
2- In hibernate configuration, you need to set the property
"hibernate.hbm2ddl.auto" to "update"
3- For Hibernate Applications, use "CustomFieldsConfiguration" to build session
factories.
For Spring Applications, use "SpringCustomFieldsFactoryBean" to build
LocalSessionFactoryBean.
4- The UI should have pages for adding custom fields which will call the methods provided
in "CustomFieldsConfiguration" or "SpringCustomFieldsFactoryBean".
Current Implementation:
=================
The current implementation enables "Custom Fields" support to hibernate or
spring applications that are using hibernate for persistent.
Current Limitations:
==============
The current implementation only supports adding new custom fields of premitive types.
--
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