|
From: Christoph S. <ch...@sc...> - 2002-10-12 14:48:54
|
Hi All! I'd like to implement a new feature in Hibernate, but I dont know how to start best. I would like to be able to map classes that dont really exist as javaclass, but use a dynabean instead http://www.apache.org/~jvanzyl/jakarta-commons/beanutils/apidocs/org/apache/commons/beanutils/DynaBean.html (or a map). All seems to be quite easy, refactor all stuff that loads and initializes a bean to a pluggable factory, and there if the loading of the class fails just create or initialize a Dynabean or Map (or maybe a HibernateGenericValueHolder) instead. The only problem is: The Hibernate API :) Session.load, Session.update, etc all get a java.lang.Class Argument. Do you think it would be possible to add functions that get a classname as String instead? Maybe the functions that take a string as argument should always use Holders instead of beans. I realize that this would be big changes, but if you think that this would be a good idea, I would just go ahead and try to implement it. The inspiration to this comes from the ofbiz entity engine, which always uses generic holders instead of Beans, which i dont really like, but its really nice for some usecases, e.g. letting your user add colums to a table at runtime without restarting the server. I recognize that i could dynamically generate a bean with bcel, but once that bean is loaded i cant add properties to it, so I'd really prefer a map. regards chris |