EJB Spec 3.1 stateful conversional state - ejb

I am new.
I don't understand the follow step of EJB 3.1 specification (Section 4.2)
The conversational state of a stateful session object is defined as the session bean instance’s field values, its associated interceptors and their instance field values, plus the transitive closure of the objects from these instances’ fields reached by following Java object references.
Any one, could show me ad example, please?
Thanks in advance
Mauro

It's simple. If a session bean has an instance field of type Foo, where Foo has instance fields bar and kaz, then the values in bar and kaz are also part of the state.

Related

API Platform custom IRI with value objects

I am currently trying to create a custom IRI for one of my entities in API Platform.
I know there is page in the documentation describing how to use a custom IRI (https://api-platform.com/docs/core/identifiers/), but I can't get it working.
My entity uses a value object for the id (currently used for IRI) and also for the name (should be used for IRI). But the values themself are priviate and scalar in the entity.
API Platform seems to get the information what should be used as the identifier, from my XML Doctrine mapping. I already tried to overwrite it by usung annotations, attributues and YAML definitions. Without luck.
The returned error reads:
preg_match(): Argument #2 ($subject) must be of type string
(at this point it receives the value object instead of the actual value)
best regards,
spigandromeda
I solved my problem.
To explain the solution, I have to dig a little into API Platform response generation.
API platform generates an IRI for every entity it returns (colelction and item operation)
it's using the Symfony router go generate the URI
all the necessary information can draw API Platform from different sources (YAML, XML, annotations, attributes)
the information include the identifier(s) defined for the entities resource
API Platform gets the value for the identifier via Symfony property accessor
because the property accessor is using getters before accessing private properties via reflection, it will return the VO
an ordinary VO cannot be used by the Symfony URL generator to create the URL
As I explained, I am using a VO for my Id as well. So I tried to figure out why it was working with the Id VO but not with the name VO.
Simple answer: the Id VO implemented the __toString method and the name VO didn't. So the solution was to let the name VO implement this method as well.
It was interesing to dig into the internal process of API Platform, but I also feel a little stupid :D

Which constructor should be used in FinalityFlow if there are no counterparties?

Starting in Corda 4 there is a deprecation warning when using the FinalityFlow(SignedTransaction) constructor stating "constructor FinalityFlow(SignedTransaction)' is deprecated. It is unsafe to use this constructor as it requires nodes to automatically accept notarised transactions without first checking their relevancy. Instead, use one of the constructors that requires only FlowSessions."
What is the best practice if there are no counterparties and we just need to issue a state into our own vault? Would we want to create a flow session with ourselves or just use the deprecated?
Same, just pass an empty list for the counterparties:
return subFlow(new FinalityFlow(signedTx, Collections.emptyList()));

EJB StatelessBean business method with Object as parameter is becoming null after deseriazation

Am using EJB Sateless Bean.
in my Bean i have one method which takes 2 parameters, first parameter is Date and the second parameter is an Object, whose syntax is as below.
RemoteINterface rm=homeInterface.create();
rm.method1(date1,mycustomObject);
AT client side am creating myCustomObject and assigned values to its properties .But when the request reaches Server side ,this object is coming as null after deserization.
Here my custom object is implementing serizable interface and it has equals and hashcode method with public default contrutor.But still am getting null.
Any idea what am missing here?

Spring MVC 3.1 - Model Attribute lost

I have a quick question on scope of ModelAttributes.
Dev. Env: Spring MVC 3.1/Java 6/JSP w/JSTL for Views
In my controller, I add an attribute to the model via
model.addAttribute(“appForResubmission”, appForResubmission);
In the JSP(served out in response to a GET request) I read it’s contents as:
${appForResubmission.appId}
— works fine and the data is shown on JSP as expected.
Upon submission of the JSP, in the same controller in a different method(in response to a PUT request), I try to read the attributes from the Model for any changes and I am doing this as
#ModelAttribute(“appForResubmission”) Application app
in the method signature.
However, all I get is a new Application object when I try to interrogate the object for data. Spring’s documentation says this kind of instantiation of a new object happens when the requested attribute does not exist in the Model.
What would cause the attribute to be lost? Any ideas? I am suspecting it is a scope issue someplace but I am not sure where the problem could be.
Any pointers you could provide is greatly appreciated?
Thank you,
M. Reddy
The scope of a modelattribute is the request, internally it is just equivalent to HttpSerletRequest.setAttribute("model", model).
If you want the model to be available in a different controller you probably have two options, one is to reconstruct it, based on what you submit to the controller or using your persistent source. The second option is for specific model attributes to be added to the session using #SessionAttribute({'modelname'}), but just be careful that you have to call SessionStatus.complete to remove the model added to the session later.

How does Spring 2.5 map the incoming request data to ModelAttribute command?

I have used Spring 2.0 and now I am using Spring 2.5 Natually, Spring 2.5 made life very easy as far as the Web Controllers are concerned. The question keeps coming in my mind that in 2.0 we had to set the command class and accordingly the AbstractFormController used to populate that command object for us. In Spring 2.5 we don't do that so how it comes know that which class to use ? Does it depend on the type of parameter we have annotated #ModelAttribute("command") to ?
If yes, then please let me know any "Utils" class that provides the exact mechanism wherein I can pass HttpRequest and class name (or Class object) and that would return me the populated object !
Hope you got my question.
Thanks in advance.
The Web MVC annotations binding eventually rely upon an
org.springframework.beans.AbstractPropertyAccessor
which has two concrete implementations:
org.springframework.beans.BeanWrapperImpl
org.springframework.beans.DirectFieldAccessor
Both accept a Java object, which will be the target to set the properties for.
The first, BeanWrapperImpl uses the setter/getter methods of a java object, while the other set the fields directly.
Both checks that the methods/fields are public/accesible, and if otherwise, use reflection's setAccessible(true) to ensure it can be set.
From the Web MVC, an instance of AbstractPropertyAccessor is created, and the parameter map of a HttpRequest is passed to AbstractPropertyAccessor#setPropertyValues.
After the call, the java object is populated with whatever is in the map

Resources