[JBoss Cache: Core Edition] - How I store objects in the cache. Trivial-not trivial?
by beep_beep
Hi.
This is probably a stupid question, but what can I do? I have that stupid problem...
suppose we have 2 classes:
1)
package com.a;
| class A{
| int x;
| List<B> b;
|
| }
2)
package com.a;
| class B{
|
|
|
| }
In short A is parent for collection of B.
A is also multiplied(collection) in DB.
Consider I produce a node, that created to hold objects of type A:
Node rootNode = cache.getRoot();
| Fqn testEntityFqn = Fqn.fromString("/com/a/A");
| Node testEntity = rootNode.addChild(testEntityFqn);
I put then A objects in this node:
testEntity.put(id, objectA);
Fine.
But I ask myself and YOU:
1. Why I've chosen to create separate node for collection of A?
2. Why not separate node for each A in collection?
3. Why not separate node for each A and separate node for each A primitive attribute(int x)?
4. When I need cache B(that under A), what is my considerations: should I create separate node for each B, or one node for collection of Bs?
5.Is there some guide line to HOW we store complex structures in the cache?
6. If object A changed and I have eviction enabled in cluster, is it explicitly invalidates also Bs, that under that A? If B changed, does it cause invalidation of A? In what case it may happen?
Thank you!!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153326#4153326
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4153326
17 years, 11 months
[Beginners Corner] - Couldn't connect to SMTP server
by lema
hallo all,
i'm trying to send email message through the code snippet below, but everytime it fails to connect to SMTP server. please, smb with experience, give a clue, what am i doing wrong?
thanks in advance, lema.
@Stateless(name="mail.sender")
@Remote(MailSenderRemote.class)
@Local(MailSenderLocal.class)
public class MailSenderBean implements MailSenderLocal, MailSenderRemote {
public static Session newMailSession()
{
try {
// Object ctx = new InitialContext().lookup("java:/Mail");
// return (Session)PortableRemoteObject.narrow(ctx, Session.class);
Session ctx = (Session) new InitialContext().lookup("java:/Mail");
return ctx;
} catch (javax.naming.NamingException e) {
e.printStackTrace();
return null;
}
}
public void sendMessage(String mailFrom,
String mailTo, String subject, String msg, boolean htmlText)
{
try{
Session session = newMailSession();
Message message = new MimeMessage(session);
if (mailFrom == null){
mailFrom = session.getProperty("mail.from");
message.setFrom( new InternetAddress(mailFrom));
}
String s[] = mailTo.split(";");
InternetAddress to[] = new InternetAddress[s.length];
/**
for(int i=0; i<s.length; i++){
to = new InternetAddress(s);
}*/
to[0] = new InternetAddress(mailTo);
message.setRecipients(Message.RecipientType.TO, to);
message.setSubject(subject);
message.setSentDate(new Date());
String textType;
if (htmlText){
textType = "text/html";
}
else {
textType = "text/plain";
}
message.setContent(msg, textType);
Transport trans = session.getTransport("smtp");
// trans.connect("111.111.111.11", "", "");
trans.connect("111.111.111.11",
session.getProperty("mail.smtp.user"),
session.getProperty("mail.smtp.password"));
trans.sendMessage(message, message.getAllRecipients());
trans.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153322#4153322
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4153322
17 years, 11 months
[Persistence, JBoss/CMP, Hibernate, Database] - Re: Problems after upgrading to 4.2.2 with MySQL and BLOB
by C-Box
Hi again
I can't say that the problem is really solved but we found a screw to turn that the error doesn't occur any longer...
within our application ear in the involved jar's --> meta-inf --> jboss-cmp-jdbc.xml we changed the read-ahead strategy from "on-find" to "on-load" and now it's working again.
Just came to it, while reading some comments in the jms config-file and JBoss-Wiki, that MySQL has some troubles reading more than one BLOB and therefore the "RecoverMessagesChunk" attribute can be set to 1.
So our jar's jboss-cmp-jdbc.xml is now starting with this defaults:
<defaults>
| <datasource>java:/AFPSDB</datasource>
| <create-table>false</create-table>
| <remove-table>false</remove-table>
| <row-locking>false</row-locking>
| <read-ahead>
| <strategy>on-load</strategy>
| <page-size>1000</page-size>
| <eager-load-group>*</eager-load-group>
| </read-ahead>
| <list-cache-max>1000</list-cache-max>
| <clean-read-ahead-on-load>false</clean-read-ahead-on-load>
| <entity-command name="no-select-before-insert"/>
| </defaults>
now it's working again. But I guess it's not the real solution, so perhaps someone could clarify, if it's more a JBoss Bug (as it worked in 4.0.2 with "on-find") or a MySQL JDBC-Driver Problem (although direct SQL via JDBC is working fine). So I think JBoss 4.2.2 Problem!!?!?!
thanks (to anyone who at least thought that problem but had no idea )
C-Box
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153312#4153312
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4153312
17 years, 11 months