[JBoss Seam] - Domain model duplicates validation
by goku2
If a have a entity like this(is just an example :D)
| @Entity
| @Name("person")
| public class Person implements Serializable {
| private Long id;
| private String firstName;
| private String lastName;
| private int age;
|
| @Id
| @GeneratedValue
| public Long getId() {
| return id;
| }
|
| public void setId(Long id) {
| this.id = id;
| }
|
| @NotNull
| @Length(max=50)
| public String getFirstName() {
| return firstName;
| }
|
| public void setFirstName(String firstName) {
| this.firstName = firstName;
| }
|
| @NotNull
| @Length(max=50)
| public String getLastName() {
| return lastName;
| }
|
| public void setLastName(String lastName) {
| this.lastName = lastName;
| }
|
| @Min(0)
| public int getAge() {
| return age;
| }
|
| public void setAge(int age) {
| this.age = age;
| }
| }
|
And i would like to know how can i create a validation method telling seam to use the firstName and the lastName as a compound id for the entity without mapping that to the database?
I want to use the id property as the id for the mapping but the logic has to be in a method. If this logic is in a @PrePersist annotates method i can only compare the entity properties but not compare them with the persisted ones.
I would like to know how can i compare if there is an existent entity in the data source like the one i'm trying to persist. Maybe i have to override the equals method?
At witch layer do i have to do this validation rule? It would be ideal to have that logic in the domain model and not have it in some stateless or statefull bean.
Thanks in advance
Humber
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048860#4048860
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048860
18 years, 11 months
[EJB 3.0] - Re: Best Practice Question
by fhh
This is not so much an EJB question but a question of database design.
There is no such thing as "the right way" to it. It all depends on the data and what you want to do with it. One of the key question is: Should you normalize the data?
This depends on what you want to do with that data. For example if you only want to dump records as fast as possible into the database I would use the fully denormalized form you suggested. However, this scenario is very unlikely.
So usually you will want to have some denomalization. How much depends again what you want to do. If you will want to filter your partictpants according to different criteria you might consider a star schema. For maximum transaction speed you would prefer to normalize the data further.
Normalization makes especially sense if you want to enforce data consistency. In your example you could move the former employers to a table of their own to make sure that there are no different spelling of the company's name.
So I cannot really help you. You know best what you want to do with the data in your application.
Regards
Felix
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048855#4048855
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048855
18 years, 11 months
[JBoss Seam] - s:selectDate in datatable
by shakenbrain
Is it possible to use the s:selectDate component in a datatable? If so, how does one populate the "for" attribute?
<rich:dataTable id="fundings" value="#{fundings}" var="f">
| <rich:column>
| <f:facet name="header">
| <h:outputText value="#{messages.ReceivedDate}"/>
| </f:facet>
| <h:inputText id="startDate" value="#{f.receivedDate}" size="10" required="true">
| <s:convertDateTime pattern="MM/dd/yyyy"/>
| </h:inputText>
| <s:selectDate for="???" dateFormat="MM/dd/yyyy" startYear="2007" endYear="2010">
| <h:graphicImage url="img/dtpick.gif" style="margin-left:5px;cursor:pointer"/>
| </s:selectDate>
| </rich:column>
| <rich:column>
| <f:facet name="header">
| <h:outputText value="#{messages.Amount}"/>
| </f:facet>
| <h:inputText id="amount" value="#{f.amount}" size="8" required="true"/>
| </rich:column>
| </rich:dataTable>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048853#4048853
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048853
18 years, 11 months
[JBoss Portal] - Re: page create, layout and theme on per user basis
by thomas.heute@jboss.com
"javatwo" wrote :
| 1. can a normal user(not admin) create a page, add portlets, design layout and apply theme, then persist them? on per user basis?
|
In the 2.6 version, users have their dahsboard, it's per user. They can add/remove pages, add/remove portlets.
"javatwo" wrote :
| 2. can page layout/theme be visually designed, for example, add/remove a region, add/remove portlets, moving portlets on the page?
|
layout/themes and pages/portlets are not coupled. See the dashboard, it seems to be what you are looking for, you can drag and drop windows from a region to another
"javatwo" wrote :
| 3. For JSF appliction ear file that has EJB entities and wars, can it migrate to Portlet? I read the portal doc that says all portlets are war files. Where to put the Entity ejb jar file?
|
It is not different, your ear will contain a web archive (war) that will contain the JSF pages and portlet descriptor.
You shoul dhave a look at the documentations and play with the portal a bit (installation is really easy, use the bundled version if you want).
For EJB3 support you will need to use the JEMS installer, but it doesn't include Portal 2.6 yet (with dashboard).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048849#4048849
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048849
18 years, 11 months
[JBoss Portal] - page create, layout and theme on per user basis
by javatwo
I am using JSF on JBoss, and thinking about using Portal. I am new to JBoss portal, and have several questions, please help.
1. can a normal user(not admin) create a page, add portlets, design layout and apply theme, then persist them? on per user basis?
2. can page layout/theme be visually designed, for example, add/remove a region, add/remove portlets, moving portlets on the page?
3. For JSF appliction ear file that has EJB entities and wars, can it migrate to Portlet? I read the portal doc that says all portlets are war files. Where to put the Entity ejb jar file?
Thanks for help.
Dave
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048846#4048846
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048846
18 years, 11 months