In my installation (8.1) the following code works to access the database 
directly in a process:


            import org.dspace.utils.DSpace;

            import org.dspace.core.DBConnection;

            import org.hibernate.Session;

            DBConnection dbConnection = new DSpace().getServiceManager()

                                       .getServiceByName(null, DBConnection.
class);

            session = (Session) dbConnection.getSession();

            session.createNativeQuery("DROP TABLE IF EXISTS 
citations_item_source").executeUpdate();

Brian Keese schrieb am Montag, 31. März 2025 um 22:13:36 UTC+2:

> Hello!
>
> I am writing a new "process" script (accessible the same as filter-media, 
> for example, by running `dspace filter-media`). This process will generate 
> a report of numbers of types of bitstreams in the system. I have written 
> other such scripts that use DAOs to access the data, but this one would be 
> much simpler to run a native sql query against the database. 
>
> I have been digging through the codebase all day, trying various things, 
> but I can't seem to get a connection to the database from that context. I 
> feel like I've done this before, but I cannot find the code.
>
> Any help?
>
> Thanks,
> Brian Keese
>

-- 
All messages to this mailing list should adhere to the Code of Conduct: 
https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
--- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/dspace-tech/3683eeab-f5dc-4547-a553-13e1ba12dd55n%40googlegroups.com.

Reply via email to