[Resin-interest] cascade persist with Amber

2008-03-31 Thread Torkil Svensgaard

Hi list

I'm playing around a bit with Amber and can't seem to get cascading 
persist to work. The attached code runs fine but doesn't persist the 
competences, only the search.


Have I misunderstood something?

Thanks in advance,

Torkil
package com.scr.data.search.entity;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;

@Entity
public class Search {

@Id
@GeneratedValue
private int _id;
@OneToMany(mappedBy=search, cascade={CascadeType.ALL}) 
private SetCompetence competences;
public int get_id() {
return _id;
}
public void set_id(int _id) {
this._id = _id;
}
public SetCompetence getCompetences() {
return competences;
}
public void setCompetences(SetCompetence competences) {
this.competences = competences;
}
}
package com.scr.data.search.entity;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Entity
public class Competence {
 
@Id
@GeneratedValue
private int _id;
private String _name;
private int _level;
private int _experience;
private int _last;
@ManyToOne
@JoinColumn(name=search)
private Search search;

public int get_id() {
return _id;
}
public void set_id(int _id) {
this._id = _id;
}
public String get_name() {
return _name;
}
public void set_name(String _name) {
this._name = _name;
}
public int get_level() {
return _level;
}
public void set_level(int _level) {
this._level = _level;
}
public int get_experience() {
return _experience;
}
public void set_experience(int _experience) {
this._experience = _experience;
}
public int get_last() {
return _last;
}
public void set_last(int _last) {
this._last = _last;
}

public Search getSearch() {
return search;
}
public void setSearch(Search search) {
this.search = search;
}

}
package com.scr.inhouse.test;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashSet;

import javax.ejb.TransactionAttribute;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.scr.data.search.entity.Competence;
import com.scr.data.search.entity.Search;

public class TestServlet extends HttpServlet {

private static final long serialVersionUID = -6604204182506392192L;
@PersistenceContext(name=search)
private EntityManager _manager;

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse 
response) throws IOException {

PrintWriter out = response.getWriter();
response.setContentType(text/html);

insert(out);
}

@TransactionAttribute
protected void insert(PrintWriter out) {
Search search = new Search();

HashSetCompetence competences = new HashSetCompetence();

Competence competence1 = new Competence();
competence1.set_level(5);
competence1.set_name(Java);

competences.add(competence1);

Competence competence2 = new Competence();
competence2.set_level(5);
competence2.set_name(PHP);

competences.add(competence2);

System.out.println(competences);

search.setCompetences(competences);

_manager.persist(search);

}
}
___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


[Resin-interest] snapshot (2008-03-31)

2008-03-31 Thread Scott Ferguson
A new snapshot is available.  It's primarily bug fixes.

There is a new, important reliability capability in Resin-Pro, based  
on monitoring the CPU load.  The stat-service in management can  
set different CPU load triggers, for example:

   logging the CPU load
   logging a thread dump if the load is high
   or even exiting Resin on very high loads

The tag docs are at http://caucho.com/resin/doc/resin-tags.xtp.  The  
will also be described at http://caucho.com/resin/doc/resin-admin.xtp

-- Scott

(2008-03-31) config: connection-max and keepalive-select-max should  
default to infinite (#2555, rep by paulberto)
config: connection-max belongs in lt;server (#2555, rep by paulberto)
admin: add thresholds for stat-service
jmx: jmx operations need to occur in classloader context of the mbean  
(#2556, rep by Karl Goldstein)
admin: add thread dumps for cpu load and ping failure (#2428)
cache: update miss rate to better reflect total caching (#2505)
openssl: ssl_write updates for SSL_ERROR_WANT_READ and  
SSL_ERROR_WANT_WRITE (#2465, rep by D Ngo)
resin.conf: ejb-server in ear-default should not have data-source  
(#2472, rep by stbu)
jsp: disable caching of static jsp pages (#2548, rep by david- 
peterson)
hessian: resource counting for SqlDateDeserializer (#2494, rep by gtong)
hessian: add content-type for servlet (#2500, rep by mccloud35)
jni: write on linux was not properly retrying on EINTR/EAGAIN (#2521,  
rep by cytown)
versioning: issues with cookies managing the versioning (#2519, rep by  
stbu)
install: add resin.conf.orig to build (#2533, rep by norlab)
server: add url-length-max configuration (#2431, rep by A C De Baca)
boot: add watchdog-address (#2717, rep by Eric Kreiser)
cache: check web-app startup when adding new cache entry (#2474, rep  
by Martin Thompson)
amber: serialization of beans with hessian (#2515, rep by Riccardo  
Cohen)
hessian: handing of InputStream.read with Hessian2 encoding (#2535,  
rep by Ray Erdelyan)
session: handle ClusterObject.isDead() state when object is loaded  
(#2477, rep by Matt Hansen)



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


[Resin-interest] Open SSL and multiple sites

2008-03-31 Thread Arthur Naylor
We have multiple sites running on Linux ... entirely through resin 3 
+. We need to implement SSL on several but not all of the sites. The  
documentation I can find seems to be for single sites on a single  
machine. Is there documentation for multiple sites on the same  
machine running on resin using Open SSL ... ??



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


[Resin-interest] admin log already exists after server restart

2008-03-31 Thread wesley

Hi Scott,

These lines in resin.conf will cause thie problem:

 management path=${resin.root}/admin
   user name=admin password=password disable=true/

   resin:if test=${resin.professional}
 deploy-service enable=true/
 jmx-service enable=true/
 log-service enable=true/
 xa-log-service enable=true/
   /resin:if
 /management


The first time I start the server, everything works fine.

But If I restart it, I get an error:

C:\resin-pro-3.1\conf\resin.conf:21: java.sql.SQLException: Table 'log_' 
already

exists.  CREATE can not override an existing table.

19:  - Remote management requires at least one enabled admin user.
20: --
21:   management path=${resin.root}/admin
22: user name=admin password=password disable=true/
23:

If I manually delete the two logs files in ${resin.root}/admin/log and start 
resin again, it started with no error.


I think this problem is a bit like http://bugs.caucho.com/view.php?id=2065 .

The s080321 and s080331 snapshot both produce this problem.

-Wesley 




___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest


Re: [Resin-interest] Session cookie in a different path than /

2008-03-31 Thread Sam
 Is there a way to set the session cookie (jsessionid) in a different path
 than the root (/)? I would like Resin sending the browser something like:
 Set-Cookie: JSESSIONID=a8_9DJBlfsEf; path=/test
 but Resin always setÑ
 Set-Cookie: JSESSIONID=a8_9DJBlfsEf; path=/
 
 We are working in a application served by different AppServer throught a
 proxy. All the requests are in the same domain but our proxy redirect the
 request to the correct AppServer discriminating by context-path. So we need
 the session cookie to be set also per context-path not in root, because if
 not the AppServer will overwrite the other AppServer cookies.

If the concern is that you have app servers other than Resin, you can
tell Resin to use a cookie name other than JSESSIONID
http://caucho.com/resin/doc/cluster-tags.xtp#session-cookie

If you have multiple instances of Resin, they will not have a problem
using the cookie value that was established by other servers, as long as
reuse-session-id is true (which is the default).

reuse-session-id is documented here:
http://caucho.com/resin/doc/session-tags.xtp

-- Sam



___
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest