Results 1 to 8 of 8

Thread: Creating hibernate project in STS 3.1.0

  1. #1

    Default Creating hibernate project in STS 3.1.0

    I am doing an example from the Pro Spring3 book where I am creating a Simple Spring Hibernate Utility Project. I select the new Spring Template Project dialogue, then go to the Persistence tab then to Simple Spring Hibernate Utility Project.

    I get the creation dialogue to enter the project name and top level package. For the package I am using "com.apress.prospring3.ch9" as the book indicate, but when the project is created the top level package is "com.apress.prospring3". Can someone tell me why this is happening?

    These are the only two entries on the dialogue box and the next step is to finalize which creates the project.

    Thanks
    Mike

  2. #2
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,640

    Default

    Hey Mike!

    The number of package levels depends on the design of the template project and most of those projects are designed to have a three-level deep package structure.

    But it looks like the regular expression that checks for the correct input in the wizard isn't defined correctly to check for *exactly* three package levels. We should fix that.

    HTH,
    Martin
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

  3. #3

    Default

    Martin,

    FYI - One thing I noted, I tried to create a com.apress.prospring3.ch9 package and the STS came back with a message that it already existed, but I could not see it in the package explorer. And I was able to create other packages that were more than 3 levels deep such as com.apress.prospring3.ch9.dao.hibernate. I just has to change some of my config.xml code to scan from com.apress.prosprig3 instead of com.apress.prospring3.ch9 as I was doing annotation component scanning.


    Thanks
    Mike
    Last edited by MikeT; Nov 15th, 2012 at 05:01 AM.

  4. #4
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,640

    Default

    Hey Mike!

    Thanks for the follow-up. You can of course create deeper nested packages manually after you created the template project. I just meant that the template itself is designed to replace a three-level package structure from within the wizard at creation. After that, you can manually change it.

    The only thing that confuses me a bit is that STS said that the forth level package already existed when you tried to create it manually. I will take a closer look at this.

    Thanks for the additional feedback!
    -Martin
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

  5. #5

    Default

    Martin,

    Your welcome for the feedback, thanks for the info.

    Mike

  6. #6
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,640

    Default

    Hey Mike!

    I tried to reproduce this and I wasn't able to (the issue with the fourth package already being created but hidden). So here is what I did:

    - started up STS 3.1.0
    - created a "Simple Spring Hibernate Utility Project"
    - used a simple name and typed in a package structure with four levels
    - project got created with three levels (as expected)
    - created the fourth package manually and it got created

    So I don't see the error that you described when creating the fourth package level. Do I need to do anything differently in order to reproduce this problem?

    Thanks for your help!
    -Martin
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

  7. #7

    Default

    Quote Originally Posted by Martin Lippert View Post
    Hey Mike!

    I tried to reproduce this and I wasn't able to (the issue with the fourth package already being created but hidden). So here is what I did:

    - started up STS 3.1.0
    - created a "Simple Spring Hibernate Utility Project"
    - used a simple name and typed in a package structure with four levels
    - project got created with three levels (as expected)
    - created the fourth package manually and it got created

    So I don't see the error that you described when creating the fourth package level. Do I need to do anything differently in order to reproduce this problem?

    Thanks for your help!
    -Martin
    Martin-

    I just tried an experiment and recreated your steps in my version of Spring 3.1.0

    - I created a Simple Spring Hibernate project
    - I used a simple project name: TestProject
    - I set the base package as com.mike1.mike2.mike3
    - The project was created with 3 levels under the src/main/java directory with the package name com.mike1.mike2
    - I created a new package com.mike1.mike2.mike3
    - This new package was created and was visible this time and I was able to add classes to it

    So I guess it is working as it is supposed to. I must have made some error last time, but I can't recall what it was. As far as I can remember I did the same thing I did this time. The only new thing I noticed since then (and I don't know if this is an error) is I tried to create a Simple Spring Hibernate Project with the default package "net.viralpatel.Hibernate" but the STS complains as soon as I type net in the package name field. I got an error as soon as I typed 'net' and it would not let me go any further with the name. I just tried doing that again and was able to create a base package of net.viralpatel.hibernate. So I don't understand these errors. Since I'm not one to believe the same code will act differently if you do the same thing, I must be making some error that I can't reproduce. At any rate, even if I have to go one level deeper, or rename some levels, the STS itself is working just fine other than that. Sorry to waste your time. If I run into any more problems like this I will be sure to try to reproduce them and take better notes on what I did and what the errors are.

    Thanks much
    Mike

  8. #8
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,640

    Default

    Hey Mike!

    Thanks a lot for your feedback. The error markers that you see in the wizard if you start typing in a package name are checking whether you have at least typed in something that is a valid three-leve package name (that is required as a minimum for the template). So if you type in just "net" or "net.second" it will not let you finish the project creation, since the template needs a three-level structure.

    Hope that explains the behavior of the wizard better... :-)

    Cheers,
    -Martin
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •