[JBoss Seam] - Re: Basic Seam questions
by SmokingAPipe
anonymous wrote : What are best practices or suggestions regarding what to bind fields in the webpage to - session beans or entities?
Bind them to what they should be bound to! If you're manipulating an object like a "Car", that has color, price, model name, etc, those should be bound directly to the car. The cool thing about Seam is that it gets rid of the whole "data transfer objects" (DTOs) thing. You certainly can use session beans as DTOs in cases where you really need to, but if you don't need to, don't! I started using Seam because I don't want to use any more DTOs. JSF backing beans are DTOs.
Why are DTOs so bad? Because they don't correspond to any part of your business. Working on stuff that's not part of your business means wasting time, effectively.
I'm a Seam newbie so I hope someone will correct me if I'm wrong on this.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994133#3994133
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994133
19 years, 4 months
[JNDI/Naming/Network] - jndi reference problem(urgent)?
by augustfox
My environment is myeclipse4.1.1+jboss4.0.1sp1+DB28.2.
When I wanna get a database connection,i meet with a problem,the error as follows:
14:38:06,343 INFO [STDOUT] javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: jdbc not bound]
14:38:06,343 INFO [STDOUT] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:999)
14:38:06,343 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
14:38:06,343 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:658)
14:38:06,343 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520)
14:38:06,343 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:347)
My code like this:
Context context = new InitialContext();
return (DataSource) context.lookup("java:comp/env/jdbc/test");
I can get connecton via context.lookup("java:jdbc/test"),
but i still want to know why context.lookup("java:comp/env/jdbc/test") not works?
I want to get your help eagerly!
my db2-ds.xml:
<local-tx-datasource>
<jndi-name>jdbc/test</jndi-name>
<connection-url>jdbc:db2:tempdb</connection-url>
<driver-class>COM.ibm.db2.jdbc.app.DB2Driver</driver-class>
<user-name>test</user-name>
test
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<type-mapping>DB2</type-mapping>
</local-tx-datasource>
my web.xml:
<resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
my jboss-web.xml:
<resource-ref>
<res-ref-name>jdbc/test</res-ref-name>
<jndi-name>jdbc/test</jndi-name>
</resource-ref>
I also tried resource-env-ref in my web.xml and jboss-web.xml,it still not works.
thanks a lot!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994132#3994132
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994132
19 years, 4 months
[JBoss Seam] - Re: Basic Seam questions
by lightbulb432
1)
Is there a DTD or some detailed documentation that is available for exceptions.xml? I did a web search on this file and noticed a link (http://jira.jboss.com/jira/browse/JBSEAM-186?page=comments) that showed a lot of proposed activity, and I'm just wondering what the final set of functionality offered by this file is.
That link talks about a lot of things like ExceptionFilter, a request-scoped variable named "exception", and some different possible tags (many of which are also provided in the link in your previous post). It'd be nice to have take a look at DTD or documentation that describes all the current possibilities with the exceptions.xml file.
2) anonymous wrote : A Seam persistence context is most like a container-managed extended persistence context. But whereas the container-managed context is tied to an SFSB instance, and hence there can be multiple contexts per conversation, the Seam persistence context has exactly one per conversation.
What implications does the existence of multiple persistence contexts per conversation have? (i.e. What negative consequence of this was being solved by the introduction of the Seam-Managed Persistance Context?)
Is it necessary (or recommended?) to use the SMPC in all cases where there exists a conversation? - I'm not sure about the decision process for which of the two to choose, and the rationale behind it.
3) anonymous wrote : There is nothing wrong with having a bunch of stateless actions all using the same conversation-scope persistence context. This is part of the magic of Seam - components with different scopes can all work smoothly together in a loosley coupled way, with no need for orchestration by the Java code.
In that case, is it correct to say that everything in Seam is stateful regardless of whether you use stateless or stateful session beans - because the component tree and state holds the information which is injected into fields of the session beans? If everything can be conveniently done with a stateless session bean because of the beauty of bijection, then when (this'll sound like a really dumb question) would you use stateful session beans at all? I imagine it'd be more than just a matter of convenience coding (e.g. saving a few merge() calls or something like that)?
4)
I need some guidance here: What are best practices or suggestions regarding what to bind fields in the webpage to - session beans or entities? If you have a Registration session bean and a Person entity, would you bind fields such as "name" to the entity directly and other things like "password1" and "password2" to the session bean (because, for example, you need to make sure both passwords are the same)?
Or is such a direct access to the entity not considered good (because that's what the session facade is meant for?), and even "name" should be bound to the session bean then passed through to the entity? Is it not good practice to, in a form with multiple fields, have some forms bound to #{register. } and others bound to #{person. }...should you remain consistent instead? What would you do?
Thanks. Whew!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994131#3994131
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994131
19 years, 4 months
[JBoss Seam] - Using DataModelSelection and @Out for an "are you sure" page
by SmokingAPipe
Here's the scenario:
I use a DataModel in my SFSB to present a table to a user. Let's say it's a table of important things that you wouldn't normally delete, like a table of Customers. I display this table, using the DataModel, and next to each Customer there is a "delete" button. Clicking "delete" will take the user to another page where the details of the customer are shown, and it says, "are you sure you want to delete this customer?" Then there is a "yes really delete" button there.
Obviously I can know which entry was clicked with a @DataModelSelection, and I can use an <s:link> to get to the "are you sure" page. I put an @Out along with the @DataModelSelection. When I do this, the DataModelSelection is being set and outjected, but it is being outjected after the "are you sure" page is rendered, so the details can't be displayed on that page.
As a hack, I have used a <h:commandButton> instaed of an <s:link>, and for the action I have used a method call that looks like this:
public String doIt() {
| return "/are-you-sure.jsp";
| }
What this does is it gets the value outjected before it needs to render the are-you-sure.jsp page.
So, that works, but it involves writing a method that doesn't do anything more than returning a string, and seems hackish.
Is there some nicer way to do this? This is important to me because I do this kind of thing all the time in my application.
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994129#3994129
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994129
19 years, 4 months