Entity annotations

5 posts / 0 new
Last post
joshkam
Offline
Joined: 11/20/2009
Entity annotations

Hello guys;

I am writting a jspresso based application that will be connecting to an existing database. I noted that jspresso generated annotated entity beans. I want it to generate the beans with correct values for table names and column names, is there a way of providing this information in the descriptor or i have to generate the beans and then change the annotations.(and then after cleanup i have to do it again)

in short what property do i change in my entity description to get the bean annotated with the correct values for table names and column names.

regards.

Josh

vvandens
Offline
Joined: 05/29/2008
DB model customization

Hi Josh,

 

Some words of caution :

First of all, you have to be aware that Jspresso has been designed to develop business apps from the ground up. This has several implications regarding the DB model, the domain model entities implementation, and so on. Although it is what makes it lightning fast to develop domain based apps, the drawback of this approach is that it is not aimed at "take your existing DB model or domain model objects and make an app out of it". It is not impossible to achieve but it is a quite risky road. It is not the objective of Jspresso to offer as much as flexibility as Hibernate for instance to map each and every existing structure. Search the forum for this "existing domain model" topic and you will get further insights.

 

Now, your actual question :

Having said that, we've discussed recently this physical table/column naming topic and this is finally something we are going to include in the model descriptors (on the entity descriptor for table names and on property descriptors for column names). But the main idea behind is not "how do I make a Jspresso app out of an existing model ?" but rather "how do I implement my organization DB naming rules/conventions when generating the DB model to support my Jspresso app domain ?", i.e. the latter will allow for fine tuning on the names but not on the structure.

Would you open a feature request for it so that it gets recorded and you can easily track progress ?

BTW, you can already customize the freemarker template used to generated the domain domain model code (including Hibernate tags), but this is not as easy as the solution above. See this thread.

 

HTH,

Regards,

Vincent

joshkam
Offline
Joined: 11/20/2009
I have opened a new request

I have opened a new request on the issue. 

 

regards.

Josh

vvandens
Offline
Joined: 05/29/2008
Done

I've implemented the feature and uploaded a new 3.0.1-SNAPSHOT.

Entity/Component descriptors as well as property descriptors can be configured with a "sqlName" property that, when set, override the standard table/column naming policy.

 

Best,

Vincent

joshkam
Offline
Joined: 11/20/2009
Entity annotations

Wow. That was fast. Let me check it out. I may be the first person to use the feature. will post the code sample here if it works.

 

Regards.