sorry.. here is the stack trace if i don't call dc.commit() until after 
looping through all the samples.

net.sf.basedb.core.BaseException: net.sf.basedb.core.data.ExtractData
at net.sf.basedb.core.HibernateUtil.loadData(HibernateUtil.java:1120)
at net.sf.basedb.core.Extract.countLabeledExtracts(Extract.java:250)
at edu.ucsd.basedb.plugins.AutoBuild.addLabeledExtract(AutoBuild.java:265)
at edu.ucsd.basedb.plugins.AutoBuild.run(AutoBuild.java:412)
at 
net.sf.basedb.core.PluginExecutionRequest.invoke(PluginExecutionRequest.java:82)
at 
net.sf.basedb.core.InternalJobQueue$JobRunner.run(InternalJobQueue.java:420)
at java.lang.Thread.run(Thread.java:613)
Caused by: org.hibernate.TransientObjectException: 
net.sf.basedb.core.data.ExtractData
at 
org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:219)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:108)
at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:87)
at 
org.hibernate.loader.hql.QueryLoader.bindNamedParameters(QueryLoader.java:517)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1576)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at 
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2144)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
at org.hibernate.loader.Loader.list(Loader.java:2023)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
at 
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at 
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at net.sf.basedb.core.HibernateUtil.loadData(HibernateUtil.java:1114)
... 6 more

thanks for any help.

-keith

Keith Ching wrote:
> Hi,
>
> I am trying to write a plugin to automatically make objects from sample 
> -> rawbioassay.
> however, after you call dc.commit() it closes the connection.  what is 
> the normal way to
> re-establish a connection?  dc.reconnect() does not seem to work.  
> getting a new dc via
> dc = sc.newDbControl(); does not seem to work either.
>
> i need to commit the created objects between steps because subsequent 
> objects do database
> lookups of previous objects to create themselves.
>
> here is my general outline.
>
>             ArraySlide slide;
>             for (Sample sourceObj : sources)
>             {
>                 dc.reattachItem(sourceObj);
>                 /**
>                  * 1. get the slide
>                  */
>                 slideName = sourceObj.getName().split(" ")[0];
>                 slide = getSlideByName(dc, slideName);
>                
>                 /**
>                  * 2. make chromatin input sample from pooled sample
>                  */
>                 Sample chromatinSample = getChromatinSample(dc, sourceObj);
>                 Extract chromatinExtract = addExtract(dc, chromatinSample);
>                 /**
>                  * 3. make the extract from the pooled sample
>                  */
>                 Extract pooledExtract = addExtract(dc, sourceObj);
>                 dc.commit();
>
>                 dc = sc.newDbControl();
>                 /**
>                  * 4. make the labelled extracts from extracts
>                  */
>                 LabeledExtract chromatinLabeledExtract = 
> addLabeledExtract(dc, inputLabel, chromatinExtract);
>                 LabeledExtract pooledLabeledExtract = 
> addLabeledExtract(dc, poolLabel, pooledExtract);
>                 dc.commit();
>                 dc = sc.newDbControl();
>                 /**
>                  * 5. make the hybridization from the matched pairs, add 
> the slide
>                  */
>                 Hybridization hyb = addHybridization(dc, 
> chromatinLabeledExtract, pooledLabeledExtract, slide);
>                 dc.commit();
>                 dc = sc.newDbControl();
>                 /**
>                  * 6. make the scan
>                  */
>                 Scan scan = addScan(dc, hyb);
>                 dc.commit();
>                 dc = sc.newDbControl();
>                 /**
>                  * 7. make the rawbioassay
>                  */
>                 String datatype = "GenePix";
>                 RawBioAssay myRawBioAssay = addRawBioAssay(dc, scan, 
> RawDataTypes.getRawDataType(datatype) );
>                 dc.commit();
>                 dc = sc.newDbControl();
>                 // group into experiment ?
>                
>                 fileNames = fileNames + " " + 
> myRawBioAssay.getName();               
>             }
>
>   

-- 
Keith Ching, Ph.D.
Bioinformatics, Laboratory of Gene Regulation
Ludwig Institute for Cancer Research
9500 Gilman Drive, #0653
CMM East, Room 3020
La Jolla, CA 92093-0653

[EMAIL PROTECTED]
858-822-5767


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
The BASE general discussion mailing list
basedb-users@lists.sourceforge.net
unsubscribe: send a mail with subject "unsubscribe" to
[EMAIL PROTECTED]

Reply via email to