You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ken in Nashua <kc...@live.com> on 2013/03/29 20:54:29 UTC
tapestry method exception
Folks,
I am trying to seed my database with two default standard entities.
is there a reason why tapestry wont allow me to catch this exception ?
Its really annoying. that I have to comment out and uncomment the code just to get my databse seeded properly.
I thought catchign the exception would be sufficient to continue... though I feel its a substabntive hack,... i got no other choice.
AppModule.JAVA
public static void contributeSeedEntity(OrderedConfiguration<Object> configuration)
{
/**/
try {
PersonBuilder pb = new PersonBuilder();
Person administrator = pb.build();
administrator.setUsername(Person.Role.administrator.toString());
administrator.setPassword(Person.Role.administrator.toString());
Set<Person.Role> roles = new HashSet<Person.Role>();
roles.add(Person.Role.administrator);
Set<Person.Permission> perms = new HashSet<Person.Permission>();
perms.add(Person.Permission.create);
perms.add(Person.Permission.read);
perms.add(Person.Permission.update);
perms.add(Person.Permission.delete);
administrator.setPermissions(perms);
configuration.add("administrator", administrator);
AdminLayoutBuilder alb = new AdminLayoutBuilder();
AdminLayout al = alb.build();
configuration.add("adminlayout", al);
} catch (Exception e) {
}
}
left outer join
UploadableMedia uploadable5_
on this_.splash_id=uploadable5_.id
where
(
1=1
)
2013-03-29 15:50:11.984:WARN::failed app: java.lang.RuntimeException: Exception constructing service 'SeedEntity': Error invoking constructor public org.tynamo.seedentity.hibernate.services.SeedEntityImpl(org.slf4j.Logger,org.apache.tapestry5.hibernate.HibernateSessionSource,java.util.List): a different object with the same identifier value was already associated with the session: [org.tynamo.examples.pphl.model.AdminLayout#1]
2013-03-29 15:50:11.984:WARN::Failed startup of context org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@167e003{/,C:\Prototype\Mavenized\Product\tynamo\trunk\tynamo-examples\pphl\src\main\webapp}
java.lang.RuntimeException: Exception constructing service 'SeedEntity': Error invoking constructor public org.tynamo.seedentity.hibernate.services.SeedEntityImpl(org.slf4j.Logger,org.apache.tapestry5.hibernate.HibernateSessionSource,java.util.List): a different object with the same identifier value was already associated with the session: [org.tynamo.examples.pphl.model.AdminLayout#1]
at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75)
at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:54)
RE: tapestry method exception
Posted by Ken in Nashua <kc...@live.com>.
Ok the catch block is vestigial since the exception is thrown after the method is processed... not during...
So back to commenting out the code to seed my database.
Does anyone have any ideas? I cant invoke a hibernate session here due to separation of concerns.
Thanks
Re: tapestry method exception
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 29 Mar 2013 16:54:29 -0300, Ken in Nashua <kc...@live.com>
wrote:
> a different object with the same identifier value was already associated
> with the session: [org.tynamo.examples.pphl.model.AdminLayout#1]
This is a pure Hibernate problem in your code. Just Googling the error
message above led me to this, which tells you what you did wrong:
http://stackoverflow.com/questions/10849974/a-different-object-with-the-same-identifier-value-was-already-associated-with-th.
Please check whether the issue is a Tapestry one before posting in the
Tapestry mailing list. And please always post the full stack trace.
--
Thiago H. de Paula Figueiredo
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org