Any possible workaround to use annotations that require an enum constant...

I am doing code generation and following the generation gap pattern (http://www.research.ibm.com/designpatterns/pubs/gg.html). For JPA i add a few annotation like @Table or @Inheritance to the generated-once client class and not the always-generated base class. However the problem is that if the values of those annotations change, it doesnt get reflected in the generated-once code, since its only generated once - the 1st time and never touched again.
So was trying in some way to get the annotations be on the base class thats always generated and did whats mentioned in this newsgroup post http://www.eclipse.org/newsportal/article.php?id=79805&group=eclipse.platform#79805
However it doesnt work since java doesnt like non enum constants in the annotation.
I wonder if there is some approach people have come across to address this kind of problem? (apart from say generating an orm.xml always to put annotations in there)

Priyajeet wrote:
Thats what I am generating. One class is getting split into two. One always generated, while the other generated once.
You are still missing the point of the pattern.
The pattern is
<Class that is NOT generated> becomes <generated class> <manual class>
And as I already said the fact that you have another generated class doesn't mean that you can't apply the pattern to second class.
Consider this UML diagram where A --> B means A extends B
4 Files get generated
1] ABase extends B (always generated)
2] A extends ABase (generated-once)
3] BBase (always generated)
4] B extends BBase (generated once)
It is 2 and 4 that will get the annotations for JPA - @Entity, @Table and @Inheritance.
1 and 3 will get @MappedSuperclass.
So my problem above that I mention applies to the Child (A or B) and not Parent (ABase or BBase)
The seperation into functional units are joined by inheritance.
Java doesnt have partial class methodology.
So inheritance joins the 2 functional units.That entire explanation doesn't matter. Actually the pattern doesn't matter either.
Code generation, all code generation is simple.
You take 'source', run it through a 'tool' and the output is 'code'.
For that to work you MUST have 'source' and a 'tool' that produces the 'code' that you want. If one of those pieces is missing you can't use code generation.
The variations on that are infinite. The only limitation is complexity and that at some point you reach a point of diminishing returns where it costs more to do the code generation (including maintainance) than it does to do it manually.
So your options are
1. Find some way to generate it all.
2. Find some way to seperate some of the code out so some can be generated and the other is manual (and this is sort of the point of the pattern.)
3. Do it manually.
There is no magic. I would also like to suggest that you forget about the pattern entirely. It is clever but it is more of a intro to code generation and you appear to be limiting the possibilities by that pattern and you do not need to do that.

Similar Messages

  • Is there any way i can use something  that uses uses power pc

    is there realy any possible way to use something that has power pc on lion

    If you have an external drive and a snow leopard disk it's pretty easy. Just install SL on external and problem solved
    That's what I love about OS X, it's so easy to install and run off a spare drive!

  • When I try to use games that require thne internet is says no internet access and when I try to google it It says can't reach google at this time

    when I try to use games that require the internet it says no internet access and I can't download messages and Can't ask questions of Google it can't reach Google at this time.  How can I get this remedied ?

    Wifi is on and connection is properly established with correct log in information?  Mobile data is set to ON?  No restrictions on background data enabled?  Strong wifi or mobile data signal?

  • My ipod 4rth generation wont connect to my hom wifi but will connect to others . like when i try to use apps that require wifi it says i dont have wifi . HELP !

    my ipod 4rth generation wont connect to my hom wifi but will connect to others . like when i try to use apps that require wifi it says i dont have wifi . HELP !

    Since you have already isolated it down to your home network, if following Steve's instructions do not fix your issue, contact your Internet Service Provider or Router Manufacturer and make sure your network is set up according to this information: iOS and OS X: Recommended settings for Wi-Fi routers and access points

  • TS4207 Unable to use websites that require cookies while on cellular data

    I cannot use my iphone4 while on cellular data when trying to use websites that require cookies.  Keep getting enable cookies messages even thou they are enabled.  Once I am on wifi this issue completely disappears.

    Just another great apple mystery gone unsolved.  Thanks apple you're swell.

  • Use proxy that requires authentication

    In the Portal Global Settings page, it is not possible to specify authentication options for the proxy server.
    How can a proxy that requires authentication be used? Will this be implemented in a future version?

    The proxy uses IWA authenticationThis is the problem I think. As far as I know, to use IWA authentication, you have to configure Identity Management. Please raise a case with Oracle Support and they should guide you correctly to the root cause and possible solutions.
    Regards,
    Anuj

  • Is there any possible way to use my EOS Rebel XT for EOS Utility?

    Okay, so i want to use EOS Utility on my Digital Rebel XT camera. In case you are wondering EOS Utility is used to take a picture with the camera by just clicking a button on the computer. Its used to make it so that any pictures i take arent shaky. Anyway, there is no link for the camera and when i go to the cameras homepage, and go to softwares, There is no download link for EOS Utility for my camera. Is there any way I can still use it on my Digital Rebel XT Camera? Let me know thanks

    FantasticMrFox wrote:
    Okay, so i want to use EOS Utility on my Digital Rebel XT camera. In case you are wondering EOS Utility is used to take a picture with the camera by just clicking a button on the computer. Its used to make it so that any pictures i take arent shaky. Anyway, there is no link for the camera and when i go to the cameras homepage, and go to softwares, There is no download link for EOS Utility for my camera. Is there any way I can still use it on my Digital Rebel XT Camera? Let me know thanks Other responses have gone off to explain some other solutions before answering your question. The simple answer is "NO". You cannot use your camera tethered to a computer, controlling it via EOS Utilities software (or Lightroom, for that matter). In order to do that, the camera must have the Live View feature. Your XT (aka 350D, from 2005) doesn't have Live View. There was a version of LV on the EOS 20Da (2005), a more complete implementation of it on the 40D (2007), and among the Rebel-series models the XSi and XS were the first to get LV (aka 450D & 1000D, both introduced in 2008). Other responses are on some right tracks, though. If your primary purpose is to help prevent camera shake, there are several other things you can do, which you may or may not be aware of... - Set a faster shutter speed. Of course, to do so may require a larger lens aperture and/or a higher ISO.  - Get and use a lens with IS (Image Stabilization).- Use flash, it freezes both subject movement and camera shake, approx. like 1/720 shutter speed would, with most flashes.- Use a tripod along with:- - a remote release (RS-60E3 wired or RC-6 wireless)- - or just use the camera's self-timer delay - - and/or use mirror lockup (Custom Function 7) Tripod quality has a great deal of effect. Some are so flimsy as to be hardly worth using. For example, the most stable tripods do not use a center column or, if it has one, the tripod is tall enough to be used without raising the center column much or at all. Materials make a differentce, too... for example carbon fiber is much better absorbing fine vibration than metal. There are a number of other factors that go into making a tripod stable. Do some additional research, if interested. Note: RC-6 wireless release uses infra red and the sensor for it is on the front of the camera. This is certainly useful for self portraits, but may be problematic using this remote for other types of photos. In addition to the Canon RS-60E3 wired remote release, there are other brand remote switches including some that have additional features such as delay timers, interval timers (time lapse), etc.  AFAIK, Canon does not make a timer/controller with E3 connectivity (like the TC-80N3, which will not connect with your camera) Note: The XT's self-timer delay is 10 seconds only. However, when used in conjunction with the mirror lockup feature, it's automatically shortened to a 2 second delay. Note: While IS lenses can make possible handholding lenses at shutter speeds 2, 3 or somtimes even 4 stops slower than you'd normally be able to use... the effectiveness of IS varies a bit from lens to lens and good handholding technique are still needed to get the best out of it. Some IS lenses require IS to be manually turned off when locked down on a tripod. The IS in those lenses can go into sort of a feedback loop where it's actually causing, rather than preventing movement. Don't worry too much about it, though... if it happens you'll see it in the viewfinder and then can turn off the IS. (No harm done to either the camera or the lens.) Hope this helps! ***********
    Alan Myers
    San Jose, Calif., USA
    "Walk softly and carry a big lens."
    GEAR: 5DII, 7D(x2), 50D(x3), some other cameras, various lenses & accessories
    FLICKR & EXPOSUREMANAGER 
           

  • Any possible way to use FireWire?

    I've got Firewire speakers that I want to use with a new 13" MacBook; however, since it doesn't have a Firewire port, I was wondering if there was some sort of USB adapter that would take the Firewire speakers? Like this...
    USB from MacBook > Firewire from USB

    There are no USB to Firewire adapters. (Desperate aluminum Macbook owners are looking, but it can't be done.) USB can not "keep up" with Firewire.
    Firewire MUST be in the computer.
    Thats what we call a "purchasing error". Just take it back and get a Macbook Pro, or a white Macbook. The pain of exchanging it will last a short time, but the pain have not having FireWire will last forever (well almost).

  • APEX app using Oracle Text  to index pages that require authorzation

    Hi Gurus and APEX Dev team
    My team need to develop an APEX App that will index all our documents spread across various servers. Some of the documents require Single sign on access (e.g. KIX.oraclecorp.com) and some require other authorization methods (e.g. Metalink) . The Question is , Is it possible to index the pages that require authorization using Oracle text. If yes How? I have implemented the demo app which can index pages that do not require authorization.
    Thanks a million
    regards
    Bala

    Hello,
    Unless I misunderstand you, the fact that the pages require authentication doesn't really matter, it is the underlying data you want to index correct? If so then you would index them in exactly the same way that you would index any table data using Oracle Text/interMedia.
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Using static .values() method of Enum in Generic Class

    Hi *,
    I tried to do the following:
    public class AClass<E extends Enum<E> >  {
         public AClass() {
              E[] values = E.values(); // this DOESN'T work
              for (E e : values) { /* do something */ }
    }This is not possible. But how can I access all Enum constants if I use
    an Enum type parameter in a Generic class?
    Thanks for your help ;-) Stephan

    Here's a possible workaround. The generic class isn't adding much in this case; I originally wrote it as a static method that you simply passed the class to:
    public class Test21
      public static enum TestEnum { A, B, C };
      public static class AClass<E extends Enum<E>>
        private Class<E> clazz;
        public AClass(Class<E> _clazz)
        {  clazz = _clazz;  }
        public Class<E> getClazz()
        {  return clazz;  }
        public void printConstants()
          for (E e : clazz.getEnumConstants())
            System.out.println(e.toString());
      public static void main(String[] argv)
        AClass<TestEnum> a = new AClass<TestEnum>(TestEnum.class);
        a.printConstants();
    }

  • Can't use any tool that requires 'mouseDown'

    Hi,
    Using Photoshop CS6 on Win7 64bit on a brand new machine with 'more than average' specs, I seem to be unable to use any tool that requires me to hold my left mouse button. Meaning;
    - I can't make selections using any marquee tool
    - I can't draw using brushes
    - I can't draw shapes (I immediatly get the 'Create rectangle' popup, as if I released my mouse button)
    - etc
    Furthermore, I can't reverse the zoom direction by holding Alt.
    I've reset my preferences to the factory default by deleting Adobe Photoshop X64 CS6 Prefs.psp from the usersettings, this does not seem to solve the problem. I've seen several posts on similar issues, where answers suggest this might be caused by a sticky spacebar; as you can see in this post, this is not the case .
    There is an exception to the above; sometimes (not always) I can selections on a fresh start of Photoshop. This ability is lost as soon as I use any other tool.
    Does anyone knows a possible cause of this problem? As you might understand, Photoshop is pretty useless this way...
    [edit]
    As this might arise as a question: it doesn't seem as if another application 'steals focus', as I can always select other tools by using their shortcuts; that would not be possible if PS wouldn't have focus.
    [/edit]

    Found the issue is even bigger: if I open the marquee menu as shown below by single-right-clicking the marquee tool, I can't left-click any of the shown tools.
    (and please don't ask which program I used to create this screenshot cut out; it's not PhotoShop, as I can't make a selection )

  • I was stollen and i used the "Remote Wipe" but i didn't know that it won't be able to locate it anymore. It still hasn't wiped it, as it has not been online yet.  Is there any possible way to undo this?

    i was stollen and i used the "Remote Wipe" but i didn't know that it won't be able to locate it anymore. It still hasn't wiped it, as it has not been online yet.  Is there any possible way to undo this?

    First of all i had already blocked it by icloud programm and then after that i received an email of confirmation that it was already blocked. Then i entered in the iCloud programm and saw that the thief it was disconected to not be localized. Do you know that even i had used the Remote Wipe it will work? Because the thief had before the blocked of the phone disconect to not be localized.

  • When I go into any app that requires me to use the key board I instantly go back to the home page and can't access anything (not even settings)

    When ever I go into an application that requires me to use the key board the app just closes down and takes me back to the home page.  I can't even get into settings.  Also if I bring up the key pad it just sticks after I press a couple of keys?  Help?  I can't get into fb/pages anything!

    Try This...
    Close All Open Apps...  Perform a Reset... Try again...
    Reset  ( No Data will be Lost )
    Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Release the Buttons.
    http://support.apple.com/kb/ht1430

  • I have some redundant site that needs to be saved for possible renewed online use.  Any ideas how to

    Can any one advise me on what ways to go to save my sites that are redundant on the next period but should be on line again if needed.
    I know that FTP, nowadays SFTP can be used for that, trouble is that I forgot the login convention. Can you please let me know that?
    Also perhaps there are different ways besides SFTP?
    Thanks a lot,
    Simon

    Hi Simon,
    Here's the kb article on SFTP: http://helpx.adobe.com/business-catalyst/partner/connecting-site-using-ftp-client.html
    You should be able to connect to you site and create a local back-up of your files.
    Kind Regards,
    Alex

  • My iPhone 5s has been stolen during a concert. I tried to use the app Find my iPhone but it said that it was offline. Is there any possible other way to locate? please help!

    My iphone has been stolen during a concert. I tried using the app Find my iPhone but it said it was offline. Is there any possible way you could help me? please help!

    No. If it is offline then it is not capable of being located over the web.

Maybe you are looking for