Wanted to get some clarification on JavaCompiler and Reflection

Hello,
I am working on building a modular, dynamic framework for web apps. The idea is highly reflection driven controllers and DAO's (no real news here, everyone does this, I was just giving some background).
One of the pieces I wanted to build was a dynamic search criteria object to pass to the DAO, used to filter collections coming back from the persistence layer. I wanted these to be runtime compiled so they would change with any changes to their corresponding data transfer object(I have written many of these, they are repetitive, and that means that they are a good candidate for a program to write for me). I settled on this because I needed to be able to fill the objects with data, and it seemed like the best way to me(I think an enum could also have worked, but I have not used these much and runtime compilation just sounds so neat).
So I have the service built to dole out the dynamic search criteria objects, and I have them compiling with all dependencies satisfied, and that all looks good.
Then I hit the hitch, a runtime class - MyDynamicSearchCriteriaObject is used in the following manner MyDynamicSearchCriteriaObject.class.getMethods(), causing a serious failure(one that is not caught by Exception), and the program just fails.
So from what I have seen, this is due to the fact that reflection information on the classpath is stored at jvm startup in memory, and any runtime loaded class cannot be reflected on with the standard API (it looks like javassist is built just for this, but I have not fiddled with it much yet). I just wanted to get any thoughts anyone has on this, is my analysis way off base, is this how it works, is there some way to trigger a runtime refresh of the reflection structure (I doubt this would ever work due to the different classloaders).
My other question is this, if you cannot reflect on runtime classloaded classes, then they will only ever really be of value if they implement a compile-time-known interface. This would allow for dynamic implementations of a given interface via runtime compilation, but not use of the runtime loaded class by it's own type definition(via reflection).
I am a little new to all of this, this is my first stab at building such a framework, so any thoughts, help, or clarification are greatly appreciated!
Thanks,
Scott

Scott_Taylor wrote:
So I really have one core question here, do you really want to understand, or do you just want to dazzle me with your credentials (which I am not impressed with at all, I find people who flaunt their credentials generally do so because it is all that they have)?
You were obviously attempting to 'educate' me as to the benefits of code generation. That has nothing to do with your problem nor does it have anything to do with me, since obviously I am quite familar with why one would actually use code generation.
I will answer though, one last time.
And I still have no idea what you are talking about.I must be crazy or something, since there is probably nothing in the programming world that you could not understand, right? Generally, when you don't understand you probe with questions so you can understand. Unless you are looking to be dismissive, in which case, why even answer?
First there are many things that I don't understand. And which I freely admit. For example GUIs. And embedded programming. And business domains such as natural gas exploration.
However we are not discussing one of those topics. But rather we are discussing a code generation and, apparently, SQL/data dynamic expression creation. And those are in fact topics that I know a great deal.
Any compilation of that is only going to provide a minimal gain when compared to the database hit itself.I really don't understand this, and it leads me to believe we are not understanding each other. I am not compiling sql, consider this:
Collection<C> list = myNeatDAO.search(Object someDTOSearchCriteria);This searchCriteria object is what I am trying to dynamically compile, again, not for performance in any way, rather to avoid writing code that is 100% based on another class (a class which may change over time). The formation of the query (whether sql or hql or whatever) is handled via reflection on the search criteria and a parameterized class in the DAO subclass's definition:
class MyNeatDAO<SomeDTO> extends AbstractDAOImplementation{}So we compare the classes and form some kind of query in the DAO. This is pretty standard stuff. I think where the wires are crossed is that you are 1)not reading attentively (if you had you would know that I marked this complete many posts ago) and 2) are not understanding the goal of the code.
You got part of it correct in that someone isn't reading carefully and that someone doesn't understand.
Myself I understand your problem several posts ago.
What you failed to understand that you are attempting to create a system that I have already done so. Several times. It never required runtime compilation.
Perhaps I wasn't clear before. Hopefully this will make it clearer.
1. Given a system of DTOs that exist as compiled units (they could even be created at runtime.)
2. A solution can be built which allows for full expression creation for queries based on those DTOs.
3. That solution does NOT require runtime compilation.
4. That solution does NOT require changes for future DTOs changes (which would seem obvious given that it can support DTOs compiled at runtime.)
>
Code generation is dependent on code patterns. That is true whether
one shot or ongoing. Nothing else.
Runtime functionality on the other hand is driven by user requirements.
Code generation is a tool to achieve that and nothing else.I have two thoughts here.
First, if you have a clear, unwavering requirement(or pattern) based purely on some other single class, how does it make sense not to automate that? Why would I want to write what is basically a near copy of the original dto each time? Not only does this increase development time (basically paying a developer to do a job a monkey could do), but it also increases modification time later when the true requirements are either discovered or the original communicated requirements change. If this single class is runtime compiled based on the dto, if you change the dto, the change to the corresponding search criteria class is automatic and perfect. There is no debug time, it just works since you are not writing it and introducing errors. The drawback is that you lose control over that class, which in this case does not create a major problem.
Again you failed to read "attentively". Why do you think that I myself would have been using code generation since before java existed?
Did you not understand that I have in fact been doing it? Or did you not understand that "before java" means that I have been doing it for a long time?
I didn't bother mentioning it before but I also worked on a system which used runtime compilation extensively. Matter of fact one of the expression engines that I created was used in that system. However there was no need for that engine to be compiled at runtime.
My second thought is that code generation is a tool to meet customer requirements, just like anything else in the software world. There are internal and external customers, and their needs must be balanced. The tool is in the box, and I am going to use it as I see fit. If you think this is wrong or off base, please express this in a useful way, I have laid my cards on the table pretty clearly (I think), if you see something glaring, explain what is wrong, don't just spew dismissive one-liners. That only makes me believe that you can't explain what is wrong(I have seen this a lot with programmers, they don't answer in a clear manner because they can't), and that you just want to be condescending, which I find a little sad. Consequently, this leads me to believe that you probably can't back up anything you are saying, and I may miss a very valid point since you never expressed it in any clear manner.
You have written customer requirements that state explicitly that the system must have a SQL/data query system in place that is compiled at runtime?
Unusual requirements. Most requirements would be along the lines of "call center employee must be able to enter customer last name or phone number or both"

Similar Messages

  • I want to get some materials about MaxL and ESSCMD

    Hi,
    I want some materials about MaxL and ESSCMD,or if I want to give a guide about this,what I will say,Thank you for your greatful help.

    Hi,
    You can find study material about Maxl and Esscmd from following location --->
    http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/html_esb_techref/techref.htm
    But if you want pdf file for these then give me your id and I will send you the same.
    Hope it answered your question.
    Regards,
    Atul Kushwaha

  • I'm having trouble loading photos on my I phone 4s and I pod.  I don't see the photos tab in Itunes?? Prob user error but wanted to get some help.

    I'm having trouble loading photos on my I phone 4s and I pod.  I don't see the photos tab in I-tunes? I'm sure its user error but wanted to get some help.

    What's the origin of this external drive? It sounds very much like it's a Windows-formatted (NTFS) drive which Macs can't write to. If you can, copy the files off the drive, reformat it as Mac format (using Disk Utility) and copy the files back. If you need to continue writing to it from a Windows PC, you should format it ExFAT in Disk Utility.
    Matt

  • My iTunes says I owe $5.25 for songs that I have already paid for and am not going to pay for again but I want to get some apps from the store and now there's a hold on my account. Who do I talk to get the hold taken off

    I explained it most in my question but I am getting charged double for songs that I have already paid for and am not going to pay for twice because that is messed up. But I want to get some apps from the store and it wont let me because of $5.25. Who can I talk to about resolving this issue?

    You're right, it would have been covered under warranty. But because of the user damage, chances are there's a 200-something dollar fee . If you explain to them that it had a defect previously, they might replace it for you at no charge. **MIGHT**. But they would have to believe that it had a defect previously.

  • My friend wanted to get some of the music off my itunes. when syncing it needed to udate her phone which it did - now all her photos are gone. and the last back up was from when she used my itunes 6  ago. How can we get back her photos :(Please help

    My friend wanted to get some music off my itunes - when syncing it it said she had to update her phone software first - which it did. Now all her photos are gone. When we tried to restore the last back up - the only one was from when she used my itunes 6 months ago which was from her old iphone. So now it has put all her photos from her old phone onto her new iphone and deleted all the new ones. We cannot find her new photos. Please help and there was 100 new pics. Is there any way we can get them back. I already have the program Asoftech - but it doesnt seem to register the iphone only C and D drive. Please help!

    bechosken wrote:
    My friend wanted to get some music off my itunes
    This is called "stealing". You do not have the legal right to give her the music you have in your iTunes library unless you are the copyright holder.
    when syncing it it said she had to update her phone software first
    That's not quite what it said.  Someone should have paid more attention to the great big warning about the possibility of losing data if the phone wasn't backed up.
    We cannot find her new photos. Please help and there was 100 new pics. Is there any way we can get them back. I already have the program Asoftech - but it doesnt seem to register the iphone only C and D drive. Please help!
    It restored the backup that was made on your computer 6 months ago, which did not contain those photos. You're wasting your time trying to find them on the phone. They don't exist.
    Hopefully, your friend syncs her phone to her own computer on a regular basis. She needs to plug her phone into her computer and restore it from her last backup. That will restore it to the state it was in when the backup was made.
    She also needs to get in the habit of extracting the photos on a regular basis, like she would from any other digital camera.

  • HT201272 Hi guys...I have just got a new computer and want to get my library back up and running on it. However I seem to be missing some of my iTunes music purchases. Any ideas on how to get them back? They show up on my ipad but not my actual itunes acc

    Hi guys...I have just got a new computer and want to get my library back up and running on it. However I seem to be missing some of my iTunes music purchases. Any ideas on how to get them back? They show up on my ipad but not my actual itunes account.

    Hello there, Capricious13.
    There are great pointers in the following Knowledge Base article. Depending on where you see the content and where you want to get it to, this should guide you to putting it in the right place:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    http://support.apple.com/kb/ht2519
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro D.

  • I want to design some products for resale and I want to know if I can use the included Fonts

    I want to design some products for resale and I want to know if I can use the included Photoshop Fonts and Images or do I have to pay additional licensing fees?  Very new to this and just looking for some basic information or a link to specifics.  Most of what I'm searching for brings up content for publishing and I'm really looking for information about reselling items in a product line.  For example Greeting Cards, Signs etc...  Thanks so much!

    As for fonts, you don't need to do anything as long as you don't try to sell the actual font files. In print or the screen your fine to do as you want. Most fonts include a license EULA for you to read when installing them anyway.
    As for images, that may be a different story, it will depend on the image. If there is a file that accompanies the image that states you can do as you please, that fine, but other wise, assume the image is copyrighted and require permission to use.
    Some programs provide clipart that is for public use this clicpart can be printed and sold. But as with the fonts, you can not sell the clipart files themselves.
    In the EULA that accompanies the software, it should state what can be done with any clipart or fonts that are included with the software.
    If you are still in doubt, contact the company and verify it.

  • Hi, I just downloaded iBooks and I downloaded a book but i wanted to get the hunger games one and they dont Havre it so I erased the app and when I wanted to download another one it just says waiting and it does nothing , CAN YOU HELP ME!

    Hi, I just downloaded iBooks and I downloaded a book but i wanted to get the hunger games one and they dont Havre it so I erased the app and when I wanted to download another one it just says waiting and it does nothing , CAN YOU HELP ME!

    Don't know if there is an option make the download window stay up, but you can bring it back with Ctrl+J then right-click on the download to open the folder it was downloaded to.
    * keyboard shortcuts -- http://dmcritchie.mvps.org/firefox/keyboard.htm
    Where files get downloaded to is in your '''about:config''' settings.
    * [http://kb.mozillazine.org/About:config About:config - MozillaZine Knowledge Base]
    * [http://kb.mozillazine.org/About:config_entries About:config entries - MozillaZine Knowledge Base]
    check out variables beginning browser.download.

  • I want to remove some of the games and add my own; How?

    I want to remove some of the games and add my own;
    How?
    == This happened ==
    Every time Firefox opened
    == from the start

    How is that related to Firefox support?

  • I take a .NEF file and a .JPG file with every click. When I transfer the files using a flash drive to another computer I never get all of the files to transfer. I get some of the .NEF and some of the .JPGs but not all

    I take a .NEF file and a .JPG file with every click. When I transfer the files using a flash drive to another computer I never get all of the files to transfer. I get some of the .NEF and some of the .JPGs but not all. How come?

    If you're exporting a project then you'll only get the images in that project. Also if any of the masters are referenced then you won't get those masters unless you check Consolidate masters into exported library
    It might be best if you started from the beginning and explained what it is your are trying to do and how you're going about doing it. Also a description of you're hardware/software setup would be helpful.

  • HT3597 I clicked settings general accessibility triple click and clicked voice over and zoom however now I want to get it off the setting and am unable to scroll down to undo settings  (I have an ipod 4th generation)

    I clicked settings>general> accessibility> triple click and clicked voice over and zoom however now I want to get it off the setting and am unable to scroll down to undo settings  (I have an ipod 4th generation)

    If VoiceOver is on, you scroll the screen using three fingers.

  • I want to get rid of my laptop and use an iPad. Will I be able to keep my iPhone synced and updated with the iPad?

    I want to get rid of my laptop and use an iPad2. Will I be able to keep my iPhone updated and synced by using the iPad2 like I currently do with the laptop?

    No. You must use a computer to sync and update both devices via iTunes on the computer. The iPad2 cannot replace the laptop for syncing purposes.

  • Want to get some micro soft office ,,my meaning ...

    i want to open some files of micro soft power point and microsoft word from my nokia n900...i installed some office named as ..slide show to go...word to go////// but it says u have to activate it first ,,can u tell me what to do this...is there any way to get free micro soft office ( power point and micro soft word and picture manager ).....or i will have to buy it...if i have to buy it then tell me how...but i think there should be some way to get free  microsoft office or it,s key for activating it...plz tell me and help me how

    dude....it's #9!!
    9.  Office Products Free
    Be sure that you have installed the EXTRAS-DEVELandEXTRAS-TESTING catalogs.
    For Excel, you can use Gnumeric
    Open xterm
    Sudo gainroot
    Apt-get install gnumeric
    For Word, you can use Abiword
    Open xterm
    Sudo gainroot
    Apt-get install abiword

  • I want to get some things straight about iTunes

    1) iTunes will delete songs off of you iPod if you remove it from the library? Is that just using the autosych or using manually managing too?
    2) To have two libraries on iTunes, I have to create a 2nd login account on Windows? There is no other way?
    3) If i have two iPods (mini and nano) with one library, will the seperate playlists for both of them show up? Or will both iPods have the same playlists? Can we share playlists and/or keep them sepereate?
    4) My sister is already using iTunes v 4, but I would really like to upgrade to iTunes v5, if I upgrade will I lose her playlist/library info?
    5) How do I completely back up my iTunes library/playlists? Consolidating the library isnt it is it?
    I know I'm asking a lot of questions, but I am an organizational freak, and my sister is not. So it's going to be solely up to me to keep us organized, I just dont want her to lose any of her iTunes info on my account.
    Thanks for you help

    1) Yes, as long as you have autosynch on, songs that were removed from your library will be deleted off the iPod, too.
    2) Yes, iTunes doesn't support several libraries in one (windows) account
    3) It depends on what setting you choose from the iTunes Preferences (Edit->Prefs->iPod), if you check "synch checked playlists only", you'll be able to choose, which list(s) to have on each iPod.
    4) I'm not quite getting this. Are you and your sister sharing music over a network or are you talking about installing v5.0.1 on a computer you both use? Either way you shouldn't lose any playlists. But since there are so many people struggling with the update to v5.0.1, I suggest you backup your/her library files (see 5)
    5) No, consolidating means to merge several libraries into one. As for a backup, you can just copy/paste or burn all your music files onto some (other) drive - DVD f.e. Make sure you also make a backup of the library files, which are in \My Music\iTunes. You'll need to backup both, the .itl- and the .xml- file

  • HT201272 I just want to get my purchased music back and can't. why?

    I have snow leopard on my mac and It says I need to update safari before i can download my previous itunes purchases. I just want to get my music back and cant. why?

    The hardware cannot support IOS 7.

Maybe you are looking for

  • How to find i phone 5 is on which network while its not activated

    i got new mobile it was unlocked but when i restarted its not activating how to find its on what network

  • Problems Updating BB 8520 from SFR France.

    HI! I have a bb 8520 and when i open it i get an SFR icon. I works just fine but i cannot configurate my email account because i have only the "...a work email account..."option available. Also under the TCP/IP option in the advance options, I do not

  • Making sure a button does not get focussed

    Hey there I'm currently building a small search banner which comprises of three fields and a search button. The banner works great and all the fields respond well however if I use the tab key on the keyboard to move from one field to the next the sea

  • I have strange black boxes appearing at times on my desktop.

    I'm not sure why these are appearing. But this is my system and most relevant information. Model Name:          iMac   Model Identifier:          iMac5,1   Processor Name:          Intel Core 2 Duo   Processor Speed:          2.16 GHz   Number Of Pro

  • AFD validation..

    1. While doing the validation of AFD Investment data, what does the validation calculates..  what it compares with what.. 2. What kind message it gives during AFD validation. 3. How to ensure that ECC account data and AFD Investment  data is equal. 4