[hibernate-dev] annotation for adding column comments for hbm2doc

Prasanna Kothandaraman prkothan at gmail.com
Mon Jan 28 15:32:25 EST 2008


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 at 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 at 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 at gmx.de
> >
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20080129/7cc5fea6/attachment.html 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: schema_document_generation_code_flow.txt
Url: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20080129/7cc5fea6/attachment.txt 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Column.java
Url: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20080129/7cc5fea6/attachment.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: AnnotationBinder.java
Url: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20080129/7cc5fea6/attachment-0001.pl 


More information about the hibernate-dev mailing list