[JBossCache] - Caching data per user - multiple instances or not?
by augustientje
Hi,
First of all I'm a beginner with JbossCache, so please bear with me ;) What I would like to do is cache data in the web tier per user, i.e. as a replacement for some stuff I now store in the HttpSession.
What would be the best strategy when using JBossCache for this? Would I create a JBoss cache instance per user and associate that with her session, or would I create a single JBoss Cache instance, associate that with the application context and create a node per user?
The advantage of the first strategy would be that the lifetime of the cache and all of its contents are directly linked to the lifetime of the session. When the user logs of the cache is certainly cleared for this user.
On the other hand, I don't see a lot of articles or posts about JBoss Cache that advice something like this. The FAQ touches on the subject by saying that there are "some scenarios" for multiple cache instances. It would seem that caching data per user is not just some scenario but actually a major one.
Could someone please advise me in this matter?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026962#4026962
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026962
19Â years, 1Â month
[Persistence, JBoss/CMP, Hibernate, Database] - Hibernate -> not-null property references a null or transien
by sandrocchio_0.1
Hello there,
I've started using Hibernate with EJB3, but I've got the following error:
javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: eu.virtualLab.users.model.Usr.password
I've followed many tutorials (and probably this is the real problem) and my code seems to be fine
the facade bean:
//add user to database
| logger.info("[addUsr] password value? -> "+password);
| Usr user = new Usr(username,password,_role,_name,surname,companyName,vat,
| address,city,postcode,country,email,phone,false);
| em.persist(user);
The POJO
@Column(name="password", nullable=false)
| private String password;
| public String getPassword() {
| return password;
| }
| public void setPassword(String password) {
| this.password = password;
| }
The persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
| <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
| <persistence-unit name="Users-EJBModulePU" transaction-type="RESOURCE_LOCAL">
| <!-- Jboss uses hibernate as default persistence engine
| <provider>org.hibernate.ejb.HibernatePersistence</provider> -->
| <jta-data-source>java:/MySqlDS</jta-data-source>
| <class>eu.virtualLab.users.model.Usr</class>
| <exclude-unlisted-classes>true</exclude-unlisted-classes>
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
| <!-- Show and print nice SQL on stdout -->
| <property name="hibernate.show_sql" value="true"/>
| <property name="hibernate.format_sql" value="true"/>
| <!-- Use it just in development -->
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| </properties>
| </persistence-unit>
| </persistence>
The password parameter is not empty (it is showed by the logger), so where is my mistake?
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026959#4026959
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026959
19Â years, 1Â month
[JCA/JBoss] - Re: Messaging Server
by weston.priceï¼ jboss.com
I am not sure what you are really asking. As far as messaging is concerned, JBoss provides two JMS providers
1) JBossMQ
This is our legacy JMS provider installed by default with JBoss 3.x and 4.x.
2)JBoss Messaging
This is a drop in replacement for JBossMQ and provides many improvements in the areas of speed, performance, clustering etc. This will be the default messaging option in JBoss5 and can be installed in most JBoss 4.x installations.
As far as connection to the AS400 from JBoss you will want to take a look at the AS400 Toolbox. There are two versions of the toolbox. One is comercial, the other is an open source implementation. Both share the same code base so there is very little difference between the two. The toolbox allows you to use JDBC to connect t DB2 instances on the AS400.
MQSeries is, for the most part, a JMS provider (though with a large set of client side bindings other than Java). The JMS API provides a common abstraction and the JBoss JMS/JCA adapter allows you to connect to any compliant JMS provider that conforms to this API.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026956#4026956
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026956
19Â years, 1Â month
[EJB 3.0] - Re: Backing beans
by raskri
OK here is some of my code:
INTERFACE:
@Local
public interface NewSession {
String addFugl(String norsk, String latinsk);
}
BEAN:(Fugl is an EntityBean)
@Stateless()
public class NewSessionBean implements NewSession {
@PersistenceContext
private EntityManager em;
public NewSessionBean() { }
public String addFugl(String norsk, String latinsk){
Fugl fugl = new Fugl();
fugl.setLatinskNavn(latinsk);
fugl.setNorskNavn(norsk);
em.persist(fugl);
return "success";
}
}
BACKING BEAN:
public class FuglBM {
@EJB()
private NewSession bean;
private String norsknavn;
private String latinsknavn;
public FuglBM() {
}
public String addfugl(){
return bean.addFugl(norsknavn, latinsknavn); <--NullPointer(line 21)
}
public String getNorsknavn() {
return norsknavn;
}
public void setNorsknavn(String norsknavn) {
this.norsknavn = norsknavn;
}
public String getLatinsknavn() {
return latinsknavn;
}
public void setLatinsknavn(String latinsknavn) {
this.latinsknavn = latinsknavn;
}
}
FROM MY JSF I CALL:
(FuglBM is set in the faces-config.xml)
..
<h:inputText value="#{FuglBM.norsknavn}" />
..
<h:inputText value="#{FuglBM.latinsknavn}"/>
..
<h:commandButton value="Submit" action="#{FuglBM.addfugl}" />
->user is redirected in the faces-config navigation on outcome "success".
I GET ERROR:
java.lang.NullPointerException
managed.bean.FuglBM.addfugl(FuglBM.java:21)
It looks like the @EJB annotation is not giving a refferance to the bean...
-any tips?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026955#4026955
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026955
19Â years, 1Â month
[Persistence, JBoss/CMP, Hibernate, Database] - Re: IllegalArgumentException when running after redeploy
by javatwo
21:30:44,095 ERROR [STDERR] Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred calling
getter of com.dc.entity.security.User.id
21:30:44,095 ERROR [STDERR] at org.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:171)
21:30:44,095 ERROR [STDERR] at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:183)
21:30:44,095 ERROR [STDERR] at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3524)
21:30:44,095 ERROR [STDERR] at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3240)
21:30:44,095 ERROR [STDERR] at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:181)
21:30:44,095 ERROR [STDERR] at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:218)
21:30:44,095 ERROR [STDERR] at org.hibernate.type.EntityType.getIdentifier(EntityType.java:108)
21:30:44,095 ERROR [STDERR] at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:87)
21:30:44,095 ERROR [STDERR] at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1513)
21:30:44,095 ERROR [STDERR] at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1575)
21:30:44,105 ERROR [STDERR] at org.hibernate.loader.Loader.doQuery(Loader.java:661)
21:30:44,105 ERROR [STDERR] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
21:30:44,105 ERROR [STDERR] at org.hibernate.loader.Loader.doList(Loader.java:2144)
21:30:44,105 ERROR [STDERR] at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
21:30:44,105 ERROR [STDERR] at org.hibernate.loader.Loader.list(Loader.java:2023)
21:30:44,105 ERROR [STDERR] at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:95)
21:30:44,105 ERROR [STDERR] at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
21:30:44,105 ERROR [STDERR] at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
21:30:44,105 ERROR [STDERR] at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:305)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026953#4026953
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026953
19Â years, 1Â month