Vaadin Grails Plugin

The Vaadin Grails plugin works great. The only serious limitation that I see is that it limits you to a single Vaadin app. Any serious web site will have multiple Vaadin apps targeting specific areas. For example, the travel agent might have an app managing all the trips available for customers and then another app is used by the customer to manage their specific trips.

Am I missing how to configure this with Vaadin.groovy config file?

If this is not possible, are there any plans to support this? I love Grails and Vaadin, but this is a serious limitation that I cannot live with unfortunately.

Thanks in advance,
Frik

I know next to nothing about Grails, but as far as I understand it there should be no limitations from the Vaadin side. The Grails plugin is a community effort (the official roadmap is
here
), so patches are more than welcome :slight_smile:

Agree - this is definitely not a Vaadin limitation. This is a limitation of the Vaadin plugin for grails.

If no one else has done the work already, I will definitely consider updating the plugin to support this.

Thanks for your response.

Kind regards,
Frik

Can everyone please vote to show how important it is to support multiple Vaadin applications on a single Grails server?
http://jira.codehaus.org/browse/GRAILSPLUGINS-1894

This is an old post, but didn’t see an answer on here regarding this problem. I recently ran into this myself, and though, cause is unknown (something between Vaadin, Grails, and Hibernate - helpful, huh?), I was able to get around this by only showing relevant data fields in the container I was populating and ignoring those put in by GORM/Vaadin using setVisibleColumns().

Seems simple enough. Like I said, exact cause unknown, but this works in my case. Freakishly, this problem led me to start developing my Grails view layer in Zk (gasp!), but now I’m back to Vaadin and very, very relieved.

Chris

I need an answer to this problem too. I have many classes that have associations to other classes.

e.g.

Person has a Company.

I want to be able to display the Person instances with the name of the company in a Table. In other frameworks, I can use “dot notation”. e.g. firstName, lastName, company.name, company.ticker, etc…

Furthermore the Company may have an Address. Therefore, I would want to display company.address.city, company.address.state, etc…

I may want to display this in a Table or a Form.

I cannot use “eager” loading. What can I do today to get lazy loading to work?

JPA specification does not support lazy loading for detached entities, and Hibernate does not support it by design - EclipseLink does to some extent. This is further complicated by the fact that the only way to re-attach an entity to a session is to merge() it (or reload it from scratch based on the id etc).

When using the JPA-session-per-request pattern (as usual in web applications), in the next request from the UI your entities are not anymore attached to the old session, so lazy loading for them does not work. As you usually keep the restored entity instances in the application (in e.g. a Tomcat session), they are no longer valid for lazy loading upon the next request when using Hibernate.

Some frameworks - especially Web 1.0 style applications - can work with this because they never hold onto entity instances in memory but always reload them on every request. However, any system that does not do so will have problems with lazy loading when using Hibernate.

This is further complicated by the Hibernate “feature” that the session is invalidated when there is an exception, so using sessions that span many HTTP requests is not really an option either with Hibernate.

To summarize, I believe your options are to:

  • disable lazy loading selectively or
  • arrange for the entities/values to be re-loaded in each request (e.g. by not storing entity instances but only IDs) - how to do this and whether it is really doable depends on the application or
  • check whether e.g. EclipseLink works better than Hibernate in your case

Suggestions for better alternatives would be welcome.

Hey Daniel,

Have you guys with Les considered adding scaffolding to the Vaadin Grails plugin?
I mean, is it on roadmap already?

I’m asking because I’m interested in contributing to the plugin in such way but don’t want to duplicate the feature.

Speaking about contribution. Is there any specific condition to become commiter?

Regards,
topr

Commit question might be of general interest. Split the thread. The new thread can be found at
http://vaadin.com/forum/-/message_boards/view_message/454319
.

The Jira ticket that I raised originally to add support for multiple Vaadin applications using the Grails plugin has moved to:
http://jira.grails.org/browse/GPVAADIN-2

As one can see that was raised about a year and a half ago, so I don’t think that anyone has had a chance to look at it yet. I think the best way would be if we simply got commit rights or at least provided a patch that could be incorporated in the next release of the plugin.

On that note, does anyone know what the roadmap is for the plugin, if there is one?

Regards,
Fredrik

Hi Krish, have you found any solution for this problem?

Regards

[quote=krishvaadin kri krish]
Server running. Browse to http://localhost:8090/hello-vaadin
[groovyc]
Compiling 1 source file to
C:\Java\test\GrailsTests\hello-vaadin\target\classes
[groovyc]
Compiling 2 source files to
C:\Java\test\GrailsTests\hello-vaadin\target\classes
[delete]
Deleting directory C:\Documents and
Settings\admin.grails\1.2.1\projects\hello-vaadin\tomcat
2. When I load the page in browser, the page is sometimes unavailable
(error 503).
Maybe this has something to do with the first problem.
Has anyone seen the same problem?

Is the Grails Vaadin plugin still maintained?

If so, or even if not, where is the source repository located so that others might fork it?

Thanks

Hi Kirk,

here is the JIRA project for this plugin: http://jira.grails.org/browse/GPVAADIN It seems there are only new requests but not that much of done work… :-/ I have asked to upgrade the plugin to the latest version of Vaadin (but I am not sure if that is going to happen).

I am trying to develop some CRUDS with Vaadin grails plugin but i am having some problems.
Is there any tutorial? working sample?
I am having problems with data on demand because i have some tables with more than 500K records and when i use

Person.list().each { container.addBean it }

to populate the container, the entire application collapse…

can someone give me a hand with that?

thanks!

Hi Nicolash,

you might want to upgrade to latest version of plugin here: https://github.com/ondrej-kvasnovsky/grails-vaadin-plugin/downloads

tutorials doesn’t exist, but I might write one this or next week - if yes, I will keep you updated.

related to your issue, you can’t fetch data from DB like that, for it will cause big performance problems. Please have a look at https://vaadin.com/directory#addon/lazy-query-container. I am sure this is what you are looking for.

If you have problems with vaadin add-on installation, if yes - here is the tutorial: http://ondrej-kvasnovsky.blogspot.com/2011/08/how-to-add-vaadin-add-on-into-grails.html

Hy,

First I would like to thanks Vaadin team for their work and also ondrej who seems to maintain the grails vaadin plugin.
I’m studying the vaadin offcial tutorial and almost everything is working well.
My problem is that I didn’t succeed in storing my changes into the database.
in this step : https://vaadin.com/tutorial/-/chapter/interaction.form.html the commit method is required to persist the container.
My problem is that I have ConcurrentModificationException on commit https://vaadin.com/forum/-/message_boards/view_message/1164562

I’m a little bit lost and any help would be appreciated

regards

Well,

I restarted from scratch :
1 - Download the tuto project
2 - Create a grails project with your plugin
3 - Adapt the model with a domain class :


package com.vaadin.demo.tutorial.addressbook.data

class PersonModel extends Person{

    static constraints = {
    }
}

Then


public class PersonContainer extends BeanItemContainer<PersonModel> implements
		Serializable {
	public PersonContainer() throws InstantiationException,
			IllegalAccessException {
		super(PersonModel.class);
                
                addAll(PersonModel.list());
	}
}

As I run the app, I can see all my persons created in the bootstrap.
I can create a user from the interface without any bug and it is updated in the List (One bug corrected)

BUT

The new line is not stored into the database. Must I made a kind of flush? Override the commit() method?

Regards

Is anybody already had some persistance problems with grails?
Regards

Hi Thomas,

I wrote a tutorial that could help you. It is about connecting Vaadin with Grails. Could you please go step by step through this one:
http://ondrej-kvasnovsky.blogspot.com/2012/03/vaadin-and-grails-part-i-hello-world.html
and let me know if that helped you? If not, please state what version of grails, vaadin and plugin do you use.

Ondrej Kvasnovsky

Data from container are not automatically saved into the database. You have handle that event manually. So, you have to create a listener and add this listener to a button. It might look like this:


class SaveListener implements ClickListener {
 void buttonClick(Button.ClickEvent event)
  // TODO: create your instance of person.. e.g. Person p = new Person(....)
  // TODO: p.save(flush:true, failOnError: true)
 }
}