[JBoss Seam] - Initialization of Seam Application
by hamtho2
Hi,
I have a problem accessing the properties of my seam application during startup.
I´ve got the following Bean, that is started through the @Startup annotation.
| @Name("commonDataHelper")
| @Scope(ScopeType.APPLICATION)
| @Startup
| public class CommonDataHelper {
|
| @Logger
| private Log log;
|
| ...
|
| @Create
| public void init() {
| ....
| }
But when I try to access the following Properties I always get an exception, so I´ve got the idea, that it might not have been initialized yet. Is this assumption true, or do I have an other misunderstanding?
NPE if trying to access the application:
| Iterator<Locale> locales = FacesContext.getCurrentInstance().getApplication().getSupportedLocales();
|
Can´t receive the seam-RessourceBundle of my war, but only the one that lies in the sourcepath of my ejb-jar:
ResourceBundle rb = org.jboss.seam.core.ResourceBundle.instance().getBundle(bundleName, locale);
Anyone knows why?
I saw, that I could add a depends-value at the @Startup-annotation. But what would be the value to depend on?
Thank you
Thomas
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4002351#4002351
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4002351
19 years, 3 months
[Persistence, JBoss/CMP, Hibernate, Database] - How to handle several collections, which store the same enti
by toni
Hi,
I have an EmailMessage Entity, which contains four collections, which all reference the same type of entity bean, which in my case represents an EmailAddress.
So I have an EmailMessage and inside 4 collections, all of which in turn store EmailAddress Entities for the email fields to, cc, bcc and replyTo.
I looked in the database and the table for the relationship looks like this:
--------- emailmessage_emailaddress ----------------
emailmessage_id bigint NOT NULL
replyto_id bigint NOT NULL
bcc_id bigint NOT NULL
cc_id bigint NOT NULL
to_id bigint NOT NULL
-------------------------------------------------------------
If I create an EmailMessage and add one EmailAddress entity bean to one of the collections, then I get a contraint exception, because the "NOT NULL" constraint is violated.
How, can I set this up, so that this works? Is this possible at all?
Here are the 2 entity beans:
-------------------------------------------------
@Entity
@Name("emailMessage")
public class EmailMessage implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
long id;
@OneToOne(cascade = {CascadeType.ALL})
EmailAddress from;
@OneToMany(cascade = {CascadeType.ALL})
Collection to = new ArrayList();
@Temporal(TemporalType.TIMESTAMP)
Date sentDate;
@OneToMany(cascade = {CascadeType.ALL})
Collection cc = new ArrayList();
@OneToMany(cascade = {CascadeType.ALL})
Collection bcc = new ArrayList();
@OneToMany(cascade = {CascadeType.ALL})
Collection replyTo = new ArrayList();
...
}
------------------------------------------------------------
@Entity
@Name("emailAddress")
public class EmailAddress implements Serializable
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
long id;
String emailAddress;
String name;
...
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4002349#4002349
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4002349
19 years, 3 months
[JBoss Seam] - Re: Seam selectItems ignores label tag
by hubaer
Thank you for your answer petemuir.
I have removed the selectitems-1.1.0rc2.jar and the @SelectItems annotation from my ActionBean and now it works. Also works the default converter, so I can remove my class, too.
I have a question to the labeling of the entry:
As I see, I can use every attribute of the java bean defined in the var tag, but is it possible to access a localized message bundle, depending on a value from the corresponding entity.
What I have in mind is something like this:
I have this list of language objects, which I want to display in english or german or french etc. depending on the Locale.
So I like to configure a set of keys in my message properties like languagename + isocode from the language entity.
Does the Seam selectItem support multi language labelling?
Marco
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4002345#4002345
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4002345
19 years, 3 months