facebook

Customising scaffold process – 2 questions

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #324374 Reply

    Greg Soulsby
    Member

    I have reviewed the tutorials on scaffold customisation with the usual results – it looks great in the examples but when I attempt to do something for myself I realise I need to know a lot more.

    so, q1
    When CRUD scaffolding from a table the unique id is coded in the domain layer as:
    @Column(name=…

    @Basic
    (fetch=…

    @Id

    @XMLElement
    Sting name

    since we are using MySQL we also need to annotation with @GeneratedValue

    How to do this in the scaffolding process? Cant find anything remotely close in the Customization Project templates.

    q2: Further reading – can you point to some relevant documentation, examples etc

    q3: Sneaking in another one – it would be great if there was a place where example customisations were posted and discussed. For example, where MySql users could share and discuss MySQL specific scaffolding ideas. Is there a place like this?

    Greg

    #324616 Reply

    cconway
    Member

    Hi Greg,

    Sorry I missed this question or would have answered sooner. The template to modify is com/skyway.integration.data.xml/tempaltes/DataType.jet

    You’ll see in that file at around line 99 a test for whether the field is a primary key:

     <c:if test="$field/@primaryKey = 'true'">
        <persistence:id select="$field" />

    If you put your @GeneratedValue inside the if block, the @Generated value will be printed for primary keys.

     <c:if test="$field/@primaryKey = 'true'">
                <persistence:id select="$field" />
                @GeneratedValue
                </c:if>

    Unfortunately there is no further documentation or customization help other than what you’ll find on this forum.

    #324875 Reply

    Greg Soulsby
    Member

    Cindy,

    Thanks for that – makes sense.

    But when I run the scaffolding it hangs on

    “Generating domain objects from connection profile [name of connection]..: Creating operation model [deleteCLASSNAME]”.

    My process is
    – create a new code gen template, do nothing to it
    – create a new web project
    – point the web project to the template project under project->properties->MyEclipse->Customization
    – Scaffold with my usual settings
    -> from database schema
    -> with maven (same result without maven)
    -> select some tables (tried different ones,same result)
    -> Webflow

    eventually gives

    “MyEclipse has detected that less than 5% of the 1,666MB of PS Old Gen (Heap memory) space remains.

    It is strongly recommended that you exit and restart MyEclipse with new virtual machine memory parameters to increase this memory; failure to do so can result in data loss.

    Recommended memory arguments: …..”

    I will attach my log and ini files. Environment details include
    – MyEclipses for Spring 10.1 (updated today from 10.0)
    – Ubuntu op system – v 11.10, all patches applied

    When I run a scaffold normally, without the customisation, it works fine.

    Greg

    Attachments:
    You must be logged in to view attached files.
    #324974 Reply

    cconway
    Member

    Well, those are some interesting memory settings in your .ini file. Even on a 64 bit windows system, I use these settings successfully:

    -vmargs
    -Xmx1024m
    -XX:MaxPermSize=512m
    -XX:ReservedCodeCacheSize=128m

    You’ve got your -Xms = -Xmx which I don’t think is a good idea, but I’m not an expert there. I’m sure there are techniques I’m not familiar with. My understanding is that typically you’d want a startup size and then more space to grow. Your values also aren’t multiples of 1024 which is described in the java tool docs:

    http://docs.oracle.com/javase/6/docs/technotes/tools/windows/java.html

    You could try bumping your settings down to something like this:

    -vmargs
    -Xms1024m
    -Xmx2048m
    -XX:MaxPermSize=1024m
    -XX:ReservedCodeCacheSize=128m

    #324990 Reply

    Greg Soulsby
    Member

    Cindy,

    It does seem to be running out of memory, but still get

    MyEclipse has detected that less than 5% of the 1,365MB of PS Old Gen (Heap memory) space remains.
    It is strongly recommended that you exit and restart MyEclipse with new virtual machine memory parameters to increase this memory; failure to do so can result in data loss.
    Recommended memory arguments:

    It stops at exactly the same place – creating opp model. It runs the disk hard with maybe 15% CPU usage. It runs for maybe 10 min, with the memory climbing slowly till it gets over 2G and then the message appears.

    What would cause it to go into some kind of loop?

    #325166 Reply

    cconway
    Member

    Can you try deleting some of the templates in the template project, specifically the ones you won’t use? For example, if you’re only using Web Flow, then delete the ones for JSF, GWT and Flex. You can also delete the ones for appengine and dwr.

    #325186 Reply

    Greg Soulsby
    Member

    Cindy,

    That makes no change. I took the idea a little further and deleted the “findbyprimarykey” template, which I guess is where it is up to, but it still stops at the same place. I will attach a screen shot.

    By the time it stops, presumably in some kind of loop, it has created the webflow diagram but not any of the artefacts under /src/main/

    Does this process work for you? I am in Ubuntu 64bit.

    Greg

    Attachments:
    You must be logged in to view attached files.
    #325211 Reply

    cconway
    Member

    I have 64 bit windows and 32 bit ubuntu. I’ll need to set up an environment to match yours and try it out. I’ll do that and let you know how it goes.

    In the meantime, could you please try creating a clean workspace and try the customization project in that clean workspace?

    #325260 Reply

    Greg Soulsby
    Member

    Cindy,

    Clean work space makes no difference.

    I had the idea that it might be the connector. But get the same result for Derby connector and Customer table provided as the example database. I tried this combination under windows professional 64 bit using 32 bit MyEclipse and it ran fine.

    So that gets me to suspecting 64 bit MyEclipse, and or 64 bit Ubuntu, and or some setting on my environment?

    Greg

    #325632 Reply

    Greg Soulsby
    Member

    I have set up myeclispe and mysql under windows 7 64 bit and it runs without a problem.

    How do you track down the cause of a hand like this? It would be great to know is the customised scaffolding works under Ubuntu 64 bit for someone else, that way I would know it is my environment, not myeclipse or eclipse.

    #325633 Reply

    Greg Soulsby
    Member

    that should read “how do you track down a hang like this?”

    #325637 Reply

    cconway
    Member

    Unfortunately, in order to diagnose it, I’ll have to reproduce it and attach to the code in the debugger. I’ve got my Ubuntu 64 environment set up but the scaffolding fails with an error about “Too many levels of symbolic links”. It works fine without the customization project, but as soon as I add the customization project, this symbolic links error occurs. Have you encountered it before?

    I’m wondering if I’m getting farther along and this is the root cause of your problem, or whether this is something completely different.

    #325640 Reply

    Greg Soulsby
    Member

    That makes me feel a lot better!

    No, have not got that error. When I am back at computer I will detail what directories and artefacts have been created by the time mine stops. That way you might be able to tell if yours got further or less.

    #325649 Reply

    Greg Soulsby
    Member

    2 shots from screen.

    a) Error message when it hangs. It is hitting disk continually until eventually runs out of memory.
    b) The file structure of the project at this point. It looks like it has created the directories and jsp side of the project but has yet to complete anything in terms of generated java.

    Attachments:
    You must be logged in to view attached files.
    #325761 Reply

    cconway
    Member

    Thanks Greg. It appears to be failing at the same point. I have exactly the same file structure and it fails at the same point in the process. The only difference is I don’t run out of memory, but get the ant error listed below instead.

    It appears to be an infinite loop in Ant. I’m finding posts where they’ve tried to stop these types of infinite loops by adding checks for the number of times a directory has been scanned. Perhaps we have a different version of Ant resulting in different behavior. Regardless, if I can get Ant to spit out some debug info, maybe I can see what directory it’s scanning and go from there. I just wanted to let you know that I’m still working the issue.

    Caught error while checking for symbolic links
    at org.apache.tools.ant.DirectoryScanner.causesIllegalSymlinkLoop(DirectoryScanner.java:1879)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1259)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1279)
    at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1203)
    at org.apache.tools.ant.DirectoryScanner.checkIncludePatterns(DirectoryScanner.java:1022)
    at org.apache.tools.ant.DirectoryScanner.scan(DirectoryScanner.java:901)
    at org.skyway.core.ant.ResourceScanner.scan(ResourceScanner.java:103)
    at org.skyway.core.generation.customization.CustomizationCopier.getRelativeBundleEntries(CustomizationCopier.java:176)
    at org.skyway.core.generation.customization.CustomizationCopier.doCopy(CustomizationCopier.java:87)
    at org.skyway.core.generation.customization.CustomizationCopier$1.run(CustomizationCopier.java:207)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2326)
    at org.skyway.core.generation.customization.CustomizationCopier.batchCopy(CustomizationCopier.java:205)
    at org.skyway.core.generation.customization.CustomizationCopier.copy(CustomizationCopier.java:68)
    at org.skyway.core.generation.customization.CustomizationCopier.copy(CustomizationCopier.java:63)
    at org.skyway.core.generate.generator.file.FileGenerator.copyFile(FileGenerator.java:226)
    at org.skyway.core.generate.generator.file.FileGenerator.generate(FileGenerator.java:66)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChild(DescendantGenerator.java:28)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChildren(DescendantGenerator.java:21)
    at org.skyway.core.generate.generator.DescendantGenerator.generate(DescendantGenerator.java:14)
    at org.skyway.core.generate.generator.control.IncludeFragmentGenerator.generate(IncludeFragmentGenerator.java:31)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChild(DescendantGenerator.java:28)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChildren(DescendantGenerator.java:21)
    at org.skyway.core.generate.generator.DescendantGenerator.generate(DescendantGenerator.java:14)
    at org.skyway.core.generate.generator.control.IncludeFragmentGenerator.generate(IncludeFragmentGenerator.java:31)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChild(DescendantGenerator.java:28)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChildren(DescendantGenerator.java:21)
    at org.skyway.core.generate.generator.DescendantGenerator.generate(DescendantGenerator.java:14)
    at org.skyway.core.generate.generator.control.IteratorGenerator.generate(IteratorGenerator.java:28)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChild(DescendantGenerator.java:28)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChildren(DescendantGenerator.java:21)
    at org.skyway.core.generate.generator.DescendantGenerator.generate(DescendantGenerator.java:14)
    at org.skyway.core.generate.generator.control.IfGenerator.generate(IfGenerator.java:22)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChild(DescendantGenerator.java:28)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChildren(DescendantGenerator.java:21)
    at org.skyway.core.generate.generator.DescendantGenerator.generate(DescendantGenerator.java:14)
    at org.skyway.core.generate.generator.control.IncludeFragmentGenerator.generate(IncludeFragmentGenerator.java:31)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChild(DescendantGenerator.java:28)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChildren(DescendantGenerator.java:21)
    at org.skyway.core.generate.generator.DescendantGenerator.generate(DescendantGenerator.java:14)
    at org.skyway.core.generate.generator.control.IteratorGenerator.generate(IteratorGenerator.java:28)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChild(DescendantGenerator.java:28)
    at org.skyway.core.generate.generator.DescendantGenerator.generateChildren(DescendantGenerator.java:21)
    at org.skyway.core.generate.generator.DescendantGenerator.generate(DescendantGenerator.java:14)
    at org.skyway.core.generate.generator.control.ResourceGenerator.generate(ResourceGenerator.java:19)
    at org.skyway.core.generate.execute.GenerationJob.generate(GenerationJob.java:115)
    at org.skyway.core.generate.execute.GenerationJob$1.run(GenerationJob.java:59)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
    at org.skyway.core.generate.execute.GenerationJob.run(GenerationJob.java:55)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
    Caused by: java.io.IOException: Too many levels of symbolic links
    at java.io.UnixFileSystem.canonicalize0(Native Method)
    at java.io.UnixFileSystem.canonicalize(UnixFileSystem.java:157)
    at java.io.File.getCanonicalPath(File.java:559)
    at org.apache.tools.ant.DirectoryScanner.causesIllegalSymlinkLoop(DirectoryScanner.java:1857)
    … 80 more

Viewing 15 posts - 1 through 15 (of 16 total)
Reply To: Customising scaffold process – 2 questions

You must be logged in to post in the forum log in