[JBoss Seam] - OneToMany does not load
by MikeDougherty
I have a couple Entities that have @OneToMany relationships with each other. I define them as so..
| @Entity
| public class District implements Serializable {
|
| private Long id;
| private String name;
| private Region region;
| private Manager manager;
| @DataModel
| private List<Store> stores;
|
| @Id @GeneratedValue
| public Long getId() {
| return id;
| }
|
| public void setId(Long id) {
| this.id = id;
| }
|
| @Length(max=150)
| public String getName() {
| return name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
|
| @ManyToOne @JoinColumn(name="region_id", nullable=false)
| public Region getRegion() {
| return region;
| }
|
| public void setRegion(Region region) {
| this.region = region;
| }
|
| @OneToOne @JoinColumn(name="manager_id", nullable=false)
| public Manager getManager() {
| return manager;
| }
|
| public void setManager(Manager manager) {
| this.manager = manager;
| }
|
| @OneToMany(cascade=ALL, mappedBy="id", fetch=EAGER)
| public List<Store> getStores() {
| return stores;
| }
|
| public void setStores(List<Store> stores) {
| this.stores = stores;
| }
|
| }
|
| @Entity
| public class Store implements Serializable {
|
| private Long id;
| private String name;
| private String street;
| private String city;
| private String state;
| private String postalCode;
| private District district;
|
| @Id @GeneratedValue
| public Long getId() {
| return id;
| }
|
| public void setId(Long id) {
| this.id = id;
| }
|
| @Length(max=20)
| public String getName() {
| return name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
|
| public String getCity() {
| return city;
| }
|
| public void setCity(String city) {
| this.city = city;
| }
|
| @Column(name="postal_code")
| public String getPostalCode() {
| return postalCode;
| }
|
| public void setPostalCode(String postalCode) {
| this.postalCode = postalCode;
| }
|
| public String getState() {
| return state;
| }
|
| public void setState(String state) {
| this.state = state;
| }
|
| public String getStreet() {
| return street;
| }
|
| public void setStreet(String street) {
| this.street = street;
| }
|
| @ManyToOne(optional=false, fetch=EAGER)
| @JoinColumn(name="district_id", nullable=false)
| public District getDistrict() {
| return district;
| }
|
| public void setDistrict(District district) {
| this.district = district;
| }
| }
|
The relationship definition seems to work fine because when I create a Store it maintains the proper District relationship in the database.
| mysql> select * from District;
| +----+-----------+-----------+------------+
| | id | name | region_id | manager_id |
| +----+-----------+-----------+------------+
| | 1 | district1 | 1 | 1 |
| +----+-----------+-----------+------------+
|
| mysql> select * from Store;
| +----+--------+---------------+------+-------+-------------+-------------+
| | id | name | street | city | state | postal_code | district_id |
| +----+--------+---------------+------+-------+-------------+-------------+
| | 1 | store1 | 123 my street | city | st | 12345 | 1 |
| | 2 | store2 | 456 my street | city | st | 12345 | 1 |
| +----+--------+---------------+------+-------+-------------+-------------+
|
However, when I try to load this District I am getting very odd behavior. With the @GeneratedValue annotations (as above) the following DataTable only shows Store "store1".
| <h:dataTable var="store"
| value="#{districtHome.instance.stores}"
| rendered="#{ not empty districtHome.instance.stores }"
| id="stores">
| <h:column>
| <f:facet name="header">Name</f:facet>
| <h:outputText value="#{store.name}"/>
| </h:column>
| </h:dataTable>
|
In reality I do not want @GeneratedValue's for the Id field. But when I remove the @GeneratedValue annotation and input the Id's via the form I get no results in the <h:dataTable /> at all.
Nothing I have tried seems to be getting me anywhere. I've tried using that dataTable and not. I've tried using Set's and List's. I've tried it with the following in the DistrictHome.java:
| public List<Store> getStores() {
| return getInstance() == null ||
| getInstance().getStores() == null ? null :
| new ArrayList<Store>(getInstance().getStores());
| }
|
And...
| <h:dataTable var="store"
| value="#{districtHome.stores}"
| rendered="#{ not empty districtHome.stores }"
| id="stores">
| <h:column>
| <f:facet name="header">Name</f:facet>
| <h:outputText value="#{store.name}"/>
| </h:column>
| </h:dataTable>
|
|
All of which either give me no items in the stores Collection, or only one (when I expect two). I've gone through the examples (which is where I got the DistrictHome idea) and can not seem to find any differences (that solve the problem) between my code and the example code. I am at a complete loss at this point.
Where or how can I debug this to find out what the problem is and fix it? Any thoughts at all on what might be causing the problem?
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017893#4017893
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017893
19Â years, 2Â months
[JBoss Portal] - like your product
by markx
Just evaluating JBoss Portal for a project. Got everything up and running easily - great install nice and smooth. First impressions are very good. I used to work for a (very large gorilla) competitor specializing on their (closed source) portal. I actually deployed that company's first live implementation of a customer portal with portlets in 2001. Over the years I hit major problems with security, API functionality and scalability. Many battle scars. Many frustrations. That portal was bloated, buggy and a support nightmare.
It's refreshing to see your attention to standards and simplicity. Great also to see the amount of community involvement. I'm looking forwarded to delving under the hood and hope that good impressions last...
Keep up the good work ;)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017888#4017888
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017888
19Â years, 2Â months
[JBoss Seam] - Seam + IceFaces
by tony.herstellï¼ gmail.com
Is is likely that RedHat/JBoss would buy/absorb IceFaces to add them to the stack that they support?
The supportable stack for Seam is already outstripping JBoss AS now with support for WebSphere and others.
A lot of companies want "one throat to throttle" when incorporating stacks.
Advantages:
Huge experience in JBoss (Seam) team of managing Open Source Apps (many open source developers have offered to help with iceFaces but are they being utilised yet?)
Already IceFaces / Seam have a close relationship (see point above!).
One Stop Shop for training for Web2 Apps.
One $$commercial$$ support contract for using a typical stack like:
Linux Server Running Red Hat (or equiv).
Some DBase server (MySql?)
JBoss (or other supported) Application Server (cluster)
Seam App(s) (inc. Spring Legacy code) .
One Forum (with bug tracking)
Disadantages:
??
?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017883#4017883
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017883
19Â years, 2Â months
[JBossWS] - Re: Generate wsdl from JSR 181 POJO
by monowai
Indeed. Still it's nice to know what's going on behind the scenes, and a good UI is not really a substitute for clear doco.
I'm an Intellij user and with these IDE's being the memory hogs they are, running eclipse simply to maintain a few XML files is a bit of a pain; Soap's IntelliJ support is pretty basic, so I'll continue with the full UI I guess.
On the side, having just checked out the source for SOAPUI - and most of the jboss projects - it really feels like stepping back in time using ANT over Maven; All that configuration in your IDE, it's Like going from an automatic car to a manual. Geeze I've lost track of how many commons-collections and jaxb jars I've got lying around for all these o/s projects. Maven's on demand centralized repository structure is pure magic.
Oh well. The fun continues.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017882#4017882
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017882
19Â years, 2Â months
[JBoss Seam] - Null Value in s:link w/IceFaces
by gzoller
Hello,
I'm using <ice:dataTable> to render some search results, like in the hotel booking example. Here's a bit of the code:
| <ice:dataTable id="departments" width="100%" cellspacing="1"
| value="#{year.list}" var="item"
| rowClasses="rowClass1,rowClass2">
|
| <!-- More rendering stuff here -->
|
| <s:link id="viewItem" value="#{item.name}" action="#{year.selectItem(item)}"/>
|
The 'item' var is correctly assigned and the item.name value is correctly rendered. When I click on the link year.selectItem() is called, but... I get a null value passed in. For some reason the 'item' isn't being passed.
I know item is non-null because it rendered the name property correctly.
Why wouldn't it be passed to selectItem()?
I see that in the hotel booking example the list used in the ice:dataTable has a @DataModel annotation where in my app its just a list of non-Seam objects.
If I make the list a @DataModel will item then be passed?
Thanks,
Greg
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017880#4017880
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017880
19Â years, 2Â months