Hi all,
Today I made the relevant code changes in AnnotationBinder.java,
EJB3Column.java and table.ftl. Its worked like dream.Just I couldn't believe
myself.
Please take diff from the existing file and let me know your comments.
Sorry I could not send the diff.
Changes made:
Classs Name: EJB3Column.java
Methods: initMappingColumn,buildColumnFromAnnotation (with additional
parameter
String columncomment).
Class Name: AnnotationBinder.java
Methods: processElementAnnotations
Regards,
Prasanna
On 1/29/08, Prasanna Kothandaraman <prkothan(a)gmail.com> wrote:
Hi all,
Got the breakthru in problem I narrated in my earlier mail. Its because of
my ignorance ;-).
Column annotations are controlled via "XProperty property". Soon I should
start thinking about presentation layer modifications.
Please let me know if you have any inputs.
Regards,
Prasanna
On 1/29/08, Prasanna Kothandaraman <prkothan(a)gmail.com> wrote:
>
> Hi all,
>
> I have done the following
>
> 1. Created org.hibernate.annotations.Column.java
> (Well, I know its very minor task ;-) )
>
>
> 2. Understood code flow from
>
> AnnotationConfiguration --> AnnotationBinder (bindClass and
> EJB3Column.buildColumnFromAnnotation)-->
> EntityBinder(processComplementaryTableDefinitions).
>
> 3. Specifically I understood how org.hibernate.annotations.Table(comment) works
>
>
> Hence I tried to add column comment in similar fashion. The first hurdle
> I am facing is, the ColumnAnnotation class is not available at bindClass().
>
>
> Here the code:
>
> AnnotationBinder.java {
>
> ---
> bindClass(..) {
>
> ----
> ---
>
> //add process complementary Table definition (index & all)
>
> entityBinder.processComplementaryTableDefinitions(
> annotatedClass.getAnnotation( org.hibernate.annotations.
> Table.*class* ) );
>
> //Prasanna
>
> org.hibernate.annotations.
> Table tablecomment = annotatedClass.getAnnotation(
> org.hibernate.annotations.Table.*class* ) ;
>
> *if*(*null* == tablecomment)
>
> System.
> *out*.println("Table annotation class not available");
>
> *else* *if*(*null*!=tablecomment && *null*!=tablecomment.comment())
>
> System.
> *out*.println(" tablecomment :"+tablecomment.comment());
>
> *else*
>
> System.
> *out*.println(" tablecomment not available");
>
> org.hibernate.annotations.
> Column columncomment = annotatedClass.getAnnotation(
> org.hibernate.annotations.Column.*class* ) ;
>
> *if*(*null* == columncomment)
>
> System.
> *out*.println(" Column Annotation class not available");
>
> *else* *if*(*null* != columncomment && *null*!=columncomment.comment())
>
> System.
> *out*.println(" columncomment :"+columncomment.comment());
>
> *else*
>
> System.
> *out*.println(" column comment not available");
>
> entityBinder.processComplementaryTableDefinitions(
> annotatedClass.getAnnotation( org.hibernate.annotations.
> Tables.*class* ) );
> }
>
>
>
> }
>
>
>
> Here I always get "Column Annotation class not available". But not so in
> case in table annotation. It perfectly works.
>
> I tried adding Column Annotation class using AnnotationConfiguration -->
> addAnnotatedClass(..). But it didn't worked.
>
> Please see the attachment for the relevant files.
> Regards,
> Prasanna
>
>
>
>
> On 1/28/08, Emmanuel Bernard <emmanuel(a)hibernate.org> wrote:
> >
> > While not strictly useful for the comment feature, I want to add a
> > @ColumnOrFormula annotation to be able to support mixing formula and
> > columns in a user type (and a FK definition). Let's say it's a
> > lightly correlated feature.
> >
> > On Jan 27, 2008, at 19:17, Oliver B. Fischer wrote:
> >
> > > Hello,
> > >
> > > I am also still interessted in contributing to this enhancement, but
> > > didn't find enough time until now.
> > >
> > > Emmanuel, in your comment on ANN-537, you suggested an
> > > @ColumnOrFormula annotation. Could you explain your idea a little
> > bit
> > > more?
> > >
> > > Prasanna, may we can share the work on this?
> > >
> > > Bye,
> > >
> > > Oliver
> > >
> > > Prasanna Kothandaraman schrieb:
> > >> Hi,
> > >> I am looking for annotation to add column comments specifically
> > >> for documentation (hbm2doc). I understand that there is no support
> > >> for this currently.
> > >>
http://opensource.atlassian.com/projects/hibernate/browse/ANN-537
> > >> I am interested in contributing towards this.
> > >> I had hard look at the source code (especially
> > >> AnnotationBinder.java, EJB3Column.java etc, table.ftl,
> > >> DocExporter.java), but still I could not figure how to provide
> > >> this support.
> > >> Please let me know how many days it will take.
> > >> I have more than 8 years of Java development experience, and I
> > >> can pickup things quickly. Please guide me.
> > >> Thanks & Regards,
> > >> Prasanna
> > >>
> > >>
> > ---------------------------------------------------------------------
> > >> ---
> > >> _______________________________________________
> > >> hibernate-dev mailing list
> > >> hibernate-dev(a)lists.jboss.org
> > >>
https://lists.jboss.org/mailman/listinfo/hibernate-dev
> > >
> > > --
> > > Oliver B. Fischer Tel. +49 (0)30 44 79 32 51
> > > Schönhauser Allee 64 Mobil: +49 (0)178 7903538
> > > D-10437 Berlin mailto:o.b.fischer@gmx.de
> > >
> > > _______________________________________________
> > > hibernate-dev mailing list
> > > hibernate-dev(a)lists.jboss.org
> > >
https://lists.jboss.org/mailman/listinfo/hibernate-dev
> >
> >
>
>