[JBoss Seam] - Seam Hibernate Q
by tony.herstell@gmail.com
Background
After a lot of poking around with log4j I can now see the hibernate debug comments (as the exceptions are telling me very little other than Advert was invalid!)
After trapping the validation failure exception in Eclipse and looking at the message (as it really wasnt being put out by seam) it turned out that I had a
@Length 30
for an ENUM which it (Seam) really didn't like!
Its quite exciting to see what Seam persists in the Database for the Enum!
| public enum AdvertType {
| Lineage ("label_ad_type_lineage"),
| BannerAd ("label_ad_type_banner_ad");
| private final String label;
| AdvertType(String label) {
| this.label = label;
| }
| public String getLabel() { return label; }
| }
|
Bug
Anyhow, this got me futher to persisting my object... which brings me to:
I have a servies of things I expose to the client; that they can attatch to the object tree of my new object.
These have been read in before into a session scoped seam bean so I assume they are detached!
How do I manage to persist my object with these "hangers on"...
| /**
| * Utiltiy method to actually persist the Campaign.
| * TODO More error handling...
| */
| @TransactionAttribute(TransactionAttributeType.REQUIRED)
| private void save() {
| User currentUser = (User)em.createQuery("from User u where u.username = :username")
| .setParameter("username", Identity.instance().getUsername())
| .getSingleResult();
| advertisingCampaign.setAdvertiser(currentUser);
| // The targeting categoires are detached, I need to re-attatch them.
| em.merge(advertisingCampaign);
| em.persist(advertisingCampaign);
| }
|
I am guessing merge and then persist but Hiberante does not like this.
When I enter the merge I have (In a LinkedHashSet):
[Category (Id => 0, Version => 0, Name Key (inl8) => category_everything, MaintenanceDates --> MaintenanceDates, Date Effective From => 9/05/2007, Date Effective To => null), Adminsitration --> Administration, Creation Date => 9/05/2007))]
But by the time the exception happens this has gone to null.
Any suggestions? I think I am doing this completely wrong.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044247#4044247
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044247
19 years, 1 month
[JBoss Seam] - Re: framework:entity-query class attribute
by fernando_jmt
Thanks Pete, for your suggestion, nevertheless that was something I did previously.
To be specific, in the extended EntityQuery I added some generic (for all lists) methods like the total pages and the current page (among others). These changes should be used for all entity-queries in my app. Now, your suggestion obliges me to create one class for every entity query and annotate it with @Name, and each class will have exactly the same methods. I think this is not a very good solution (a lot of classes only difering the @Name, even if I have a super class I will need to extend it and add a @Name for each one), and this is the reason I ask if the entity-query class attribute can be used for that purpose (to use an extended EntityQuery instead the Seam EntityQuery directly).
Hope now is more clear than before, and you can point me out.
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044244#4044244
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044244
19 years, 1 month
[JBoss Portal] - Re: JBoss WSRP consumer and file uploads
by superfilin
Hello, Julien!
anonymous wrote : Why do you need that feature ?
The question is not about what method to use to submit the form. It is fine that all forms are using POST method. But sometimes it is needed to create a link to change portlet state instead of a form. I assume when you press the link then HTTP GET method is used, correct? This is basically a styling issue as I do not want to have form buttons everywhere where it should be a link (anchor).
As I see the following 2 ways should work equally:
| <a href="/portal/portal/default/Test/SENDEMAIL/SENDEMAIL?
| action=1d
| &
| windowstate=
| &
| mode=
| &
| ns=
| &
| is=_action=%2Fcom%2Fportal%2Ffront%2Fportlets%2FsendEmail%2FchangeStep
| &
| jbpns_2fdefault_2fTest_2fSENDEMAIL_2fSENDEMAILsnpbjstep=1">
| ....</a>
|
and
| <form action="/portal/portal/default/Test/SENDEMAIL/SENDEMAIL?
| action=1d
| &
| windowstate=
| &
| mode=
| &
| ns=
| &
| is=_action=%2Fcom%2Fportal%2Ffront%2Fportlets%2FsendEmail%2FreceiveTopic"
|
| method="POST">
| ....
|
| <input type="hidden" name="jbpns_2fdefault_2fTest_2fSENDEMAIL_2fSENDEMAILsnpbjstep"
| value="2" />
|
| ...
|
| <input type="submit">
| </form>
|
Am I missing something here? Is it possible to make the anchor above working? Currently when this kind of anchor is clicked on consumed portlet JBoss sends a message to the action specified but without "step" parameter.
Best regards,
Andrey
P.S. the form and link examples are taken from the markup shown on the consumer.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044242#4044242
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044242
19 years, 1 month