Re: problem with AbstractEntityModel from Igor Vaynberg
Am 17.05.2014 23:08, schrieb mscoon: I don't understand what these lines are doing. Are you reloading whatever is already stored in your modelObject.kunde and setting it again to your model object? Why? all ONETOMANY relationships which are set before I open the form cause problem with hibernate when I save the Model after I close the Form. When I set them once more as described below everything is OK. all ONETOMANY relationships which are set by the Form by DropDownChoices don't cause any problem. On Thu, May 8, 2014 at 7:50 AM, Piratenvisier hansheinrichbr...@yahoo.dewrote: If I include the folowing lines : if(NachweiseForm.this.getModelObject().getKunde()!=null) { Kunde kunde = kundeManager.get(NachweiseForm.this. getModelObject().getKunde().getId()); NachweiseForm.this.getModelObject().setKunde(kunde); kunde.addNachweis(NachweiseForm.this.getModelObject()); System.err.println(Kunde); } before the save everything is fine But I hoped to avoid such lines by AbstractEntityModel. My idea was to implant Kunde through the form. But how could you do it only by a Label. Am 05.05.2014 20:40, schrieb mscoon: Actually what I said below is wrong because this line is after the line that throws the exception. But my explanation still holds. Something before the line that is throwing the exception is causing an object with a reference to a new Nachweise to be saved while the Nachweise is still unsaved. You need to search at what is happening before the line with the exception, maybe even before the page is created. Now, a wild guess (I may well be wrong) is that the following line: nachweiseform.getModelObject().getKunde().addNachweis(nachwe iseform.getModelObject()); may be causing the problem if hibernate tries to save kunde with nachweiseform.getModelObject() which is a new object with a null id. You may try to move this line to saveNachweise(). On Mon, May 5, 2014 at 2:54 PM, Yahoo hansheinrichbr...@yahoo.de wrote: Am 05.05.2014 11:05, schrieb mscoon: In a previous message you sent the following snippets: //@XmlTransient @ManyToOne(cascade = CascadeType.MERGE,fetch=FetchType.LAZY) @JoinColumn(name=NachKundNr,insertable=false, updatable=false) public Kunde getKunde(){ return this.kunde; } recursive Part for Kunde @XmlTransient @OneToMany(cascade={CascadeType.MERGE},fetch=FetchType.LAZY) @JoinColumn(name=NachKundNr,insertable=false, updatable=false ) when I remove this I get the error : org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: braunimmobilien.model.Nachweise at org.hibernate.engine.internal.ForeignKeys. getEntityIdentifierIfNotUnsaved(ForeignKeys.java:249) at org.hibernate.type.EntityType.getIdentifier(EntityType.java: 459) at org.hibernate.type.ManyToOneType.nullSafeSet( ManyToOneType.java:132) at org.hibernate.persister.collection. AbstractCollectionPersister. writeElement(AbstractCollectionPersister.java:867) at org.hibernate.persister.collection. AbstractCollectionPersister. insertRows(AbstractCollectionPersister.java:1475) at org.hibernate.action.internal.CollectionUpdateAction.execute( CollectionUpdateAction.java:86) at org.hibernate.engine.spi.ActionQueue.execute( ActionQueue.java:362) at org.hibernate.engine.spi.ActionQueue.executeActions( ActionQueue.java:354) at org.hibernate.engine.spi.ActionQueue.executeActions( ActionQueue.java:278) at org.hibernate.event.internal.AbstractFlushingEventListener. performExecutions(AbstractFlushingEventListener.java:326) at org.hibernate.event.internal.DefaultFlushEventListener. onFlush( DefaultFlushEventListener.java:52) at org.hibernate.internal.SessionImpl.flush(SessionImpl. java:1213) at org.hibernate.internal.SessionImpl.managedFlush( SessionImpl.java:402) at org.hibernate.engine.transaction.internal.jdbc. JdbcTransaction. beforeTransactionCommit(JdbcTransaction.java:101) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl. commit(AbstractTransactionImpl.java:175) at org.springframework.orm.hibernate4. HibernateTransactionManager. doCommit(HibernateTransactionManager.java:554) at org.springframework.transaction.support. AbstractPlatformTransactionManager.processCommit( AbstractPlatformTransactionManager.java:755) at org.springframework.transaction.support. AbstractPlatformTransactionManager.commit( AbstractPlatformTransactionMan ager.java:724) at org.springframework.transaction.interceptor. TransactionAspectSupport.commitTransactionAfterReturnin g(TransactionAspectSupport.java:475) at org.springframework.transaction.interceptor. TransactionAspectSupport.invokeWithinTransaction( TransactionAspectSupport.java:270) at org.springframework.transaction.interceptor.
Re: Page rendering from quartz job
You want wicket's page renderer to render some HTML for your email content when you have it run inside a quartz thread? Why can't you just simply use a different template engine like Apache Velocity? Have a great day, Paul Bors On May 15, 2014, at 3:27 PM, Sandor Feher sfe...@bluesystem.hu wrote: Hi, I fired up some quartz jobs for sending notification emails at given time. The job controller class is launched from my Application wget it get initialized. Almost everything works except of rendering mail's html body. I would like to do it with wicket's pagerenderer but it throws the following error: org.apache.wicket.WicketRuntimeException: There is no application attached to current thread DefaultQuartzScheduler_Worker-5 I know it has not happen by chance but my class knows nothing about page rendering. The question is how to achieve some elegant way ? I can choose different way but if possible I do it with wicket's page renderer. So please advice! Regards., Sandor -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Page-rendering-from-quartz-job-tp4665860.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: problem with AbstractEntityModel from Igor Vaynberg
Are you not using a LoadableDetacheble model? And are you familiar with Hibernate's laizy loading? Have a great day, Paul Bors On May 18, 2014, at 6:08 AM, Piratenvisier hansheinrichbr...@yahoo.de wrote: Am 17.05.2014 23:08, schrieb mscoon: I don't understand what these lines are doing. Are you reloading whatever is already stored in your modelObject.kunde and setting it again to your model object? Why? all ONETOMANY relationships which are set before I open the form cause problem with hibernate when I save the Model after I close the Form. When I set them once more as described below everything is OK. all ONETOMANY relationships which are set by the Form by DropDownChoices don't cause any problem. On Thu, May 8, 2014 at 7:50 AM, Piratenvisier hansheinrichbr...@yahoo.dewrote: If I include the folowing lines : if(NachweiseForm.this.getModelObject().getKunde()!=null) { Kunde kunde = kundeManager.get(NachweiseForm.this. getModelObject().getKunde().getId()); NachweiseForm.this.getModelObject().setKunde(kunde); kunde.addNachweis(NachweiseForm.this.getModelObject()); System.err.println(Kunde); } before the save everything is fine But I hoped to avoid such lines by AbstractEntityModel. My idea was to implant Kunde through the form. But how could you do it only by a Label. Am 05.05.2014 20:40, schrieb mscoon: Actually what I said below is wrong because this line is after the line that throws the exception. But my explanation still holds. Something before the line that is throwing the exception is causing an object with a reference to a new Nachweise to be saved while the Nachweise is still unsaved. You need to search at what is happening before the line with the exception, maybe even before the page is created. Now, a wild guess (I may well be wrong) is that the following line: nachweiseform.getModelObject().getKunde().addNachweis(nachwe iseform.getModelObject()); may be causing the problem if hibernate tries to save kunde with nachweiseform.getModelObject() which is a new object with a null id. You may try to move this line to saveNachweise(). On Mon, May 5, 2014 at 2:54 PM, Yahoo hansheinrichbr...@yahoo.de wrote: Am 05.05.2014 11:05, schrieb mscoon: In a previous message you sent the following snippets: //@XmlTransient @ManyToOne(cascade = CascadeType.MERGE,fetch=FetchType.LAZY) @JoinColumn(name=NachKundNr,insertable=false, updatable=false) public Kunde getKunde(){ return this.kunde; } recursive Part for Kunde @XmlTransient @OneToMany(cascade={CascadeType.MERGE},fetch=FetchType.LAZY) @JoinColumn(name=NachKundNr,insertable=false, updatable=false ) when I remove this I get the error : org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: braunimmobilien.model.Nachweise at org.hibernate.engine.internal.ForeignKeys. getEntityIdentifierIfNotUnsaved(ForeignKeys.java:249) at org.hibernate.type.EntityType.getIdentifier(EntityType.java: 459) at org.hibernate.type.ManyToOneType.nullSafeSet( ManyToOneType.java:132) at org.hibernate.persister.collection. AbstractCollectionPersister. writeElement(AbstractCollectionPersister.java:867) at org.hibernate.persister.collection. AbstractCollectionPersister. insertRows(AbstractCollectionPersister.java:1475) at org.hibernate.action.internal.CollectionUpdateAction.execute( CollectionUpdateAction.java:86) at org.hibernate.engine.spi.ActionQueue.execute( ActionQueue.java:362) at org.hibernate.engine.spi.ActionQueue.executeActions( ActionQueue.java:354) at org.hibernate.engine.spi.ActionQueue.executeActions( ActionQueue.java:278) at org.hibernate.event.internal.AbstractFlushingEventListener. performExecutions(AbstractFlushingEventListener.java:326) at org.hibernate.event.internal.DefaultFlushEventListener. onFlush( DefaultFlushEventListener.java:52) at org.hibernate.internal.SessionImpl.flush(SessionImpl. java:1213) at org.hibernate.internal.SessionImpl.managedFlush( SessionImpl.java:402) at org.hibernate.engine.transaction.internal.jdbc. JdbcTransaction. beforeTransactionCommit(JdbcTransaction.java:101) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl. commit(AbstractTransactionImpl.java:175) at org.springframework.orm.hibernate4. HibernateTransactionManager. doCommit(HibernateTransactionManager.java:554) at org.springframework.transaction.support. AbstractPlatformTransactionManager.processCommit( AbstractPlatformTransactionManager.java:755) at org.springframework.transaction.support. AbstractPlatformTransactionManager.commit( AbstractPlatformTransactionMan ager.java:724) at org.springframework.transaction.interceptor.
RE: Question / Best Practise / (List)Model vs. (List)DataProvider
The way I see (right or wrong!) is, You create/manage Models for individual components on a case-by-case basis. For Repeaters which internal components are dynamically created, you need a DataProvider to create and manage those Models for the components and the Collections that comprise their data. DataProvider could be described as a 'Model Factory', and is not a Model in itself. Cheers, Col. -Original Message- From: Sven Meier [mailto:s...@meiers.net] Sent: Friday, 16 May 2014 6:17 AM To: users@wicket.apache.org Subject: Re: Question / Best Practise / (List)Model vs. (List)DataProvider IDataProvider is all about efficiency, it provides efficient access to a subset of the data. Perhaps we can make it even more efficient with the recent proposal on the @dev list. Regards Sven On 05/08/2014 01:37 PM, Patrick Davids wrote: Hi all, what I often think about, and I cannot really say is; when to use Model or DataProvider as data providing object for components they repeat some thing? Javadoc says, DataProvider are (good) for DataViews. Hmm... ok, and they allow easer iterating (first index, count). I also can achieve this by using a LoadableDetachableModelList combined with a ModelIteratorAdapater. Both have detaching logic... both featuring extension, both have a sort of load-method (getObject() vs. getData()). Sometimes I think, they are so similar to each other... where is the key difference? Would be cool if some of yours just reply his two cents of daily programming experience... so I can get some new point of views. When do you use DataProvider or ModelList? Did you experienced the same, not to exactly know which one you will use for your new page/panel/component? And often think about pro and cons using it with RepeatingViews? And later on, you see... I could have used both... hmm... thanx a lot for feedback and kind regards Patrick - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org EMAIL DISCLAIMER This email message and its attachments are confidential and may also contain copyright or privileged material. If you are not the intended recipient, you may not forward the email or disclose or use the information contained in it. If you have received this email message in error, please advise the sender immediately by replying to this email and delete the message and any associated attachments. Any views, opinions, conclusions, advice or statements expressed in this email message are those of the individual sender and should not be relied upon as the considered view, opinion, conclusions, advice or statement of this company except where the sender expressly, and with authority, states them to be the considered view, opinion, conclusions, advice or statement of this company. Every care is taken but we recommend that you scan any attachments for viruses. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org