简体   繁体   中英

Design problem with Seam

I have a clever program which given a file containing very specific metadata of a database, an entire project is generated for me in eclipse. It uses hibernate to access the database and provides basic crud functionality as well as provides xhtml interface.

It all works great and virtually anything can be done so long as simple operations are required. However, of course I'm expecting that sooner or later I'm going to need to modify this project to achieve some customized behavior.

I could just modify the project and never look back, but I'd be losing the tremendous advantage of being able to regenerate the project to add new tables and behaviors. While I could generate a new project with my changes and apply those changes by hand, I'd rather not have to do this for every change I need to make.

Unfortunately, the tool which generates this project can't be touched (for reasons that it's not our tool but a tool of a third party software company which produces project templates).

I noticed that it heavily uses the Seam framework to instantiate generated classes (using @In(create = true) ). Is there anyway to extend a generated class such that regenerating existing classes won't override my changes, yet have these extended classes be instantiated instead?

Is there some strategy that I can use in order to minimize modification to generated classes (ideal case would be to modify behavior simply by adding files to the project, though I realize that wouldn't be possible for xhtml files)? Any help would be appreciated, though I realize that some changes must be made to the tool before this would be possible (for example a factory?).

This sounds to me like seam-gen too. This can help you: http://seamframework.org/Community/ModifyingSeamgen

I don't like seam-gen. It's a shortcut tool with a price. See this post http://shervinasgari.blogspot.com/2010/10/why-you-should-not-use-seam-application.html

I love Seam, but I don't use/like seam-gen. seam-gen don't fit for real-world apps.

Besides this:

@In(create=true) BeanClass beanName

injects a bean with name "beanName" and type BeanClass, from some context. If that bean doesn't exists yet, then it will be created (because create=true). If it exists at some context (page, request, session, app, workflow, etc), it will be found it and it will be injected at property beanName.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM