Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在Apache Spark中使用hibernate类_Hibernate_Apache Spark - Fatal编程技术网

无法在Apache Spark中使用hibernate类

无法在Apache Spark中使用hibernate类,hibernate,apache-spark,Hibernate,Apache Spark,我正在尝试使用ApacheSpark进行高速计算。此计算的结果需要存储在Oracle中 我正在使用hibernate来做这件事。但是,由于hibernate-like(JDBCTransaction)中的某些类是不可序列化的——使用它们时会抛出java.io.NotSerializableException:org.hibernate.transaction.JDBCTransaction),spark cluster不支持使用hibernate 使用hibernate与spark一起工作有什么

我正在尝试使用ApacheSpark进行高速计算。此计算的结果需要存储在Oracle中

我正在使用hibernate来做这件事。但是,由于hibernate-like(JDBCTransaction)中的某些类是不可序列化的——使用它们时会抛出java.io.NotSerializableException:org.hibernate.transaction.JDBCTransaction),spark cluster不支持使用hibernate

使用hibernate与spark一起工作有什么解决方法吗


我尝试使用字节码注入将JDBCTransaction类标记为可序列化,但它抛出java.lang.IllegalStateException:unread block data exception。

听起来像是试图在驱动程序中创建事务对象,并在RDD分区上执行事务。这就是为什么会出现可序列化的异常;spark执行试图将事务对象发送到远程进程,这显然不起作用。即使可以序列化它,在多个远程并行事务中使用同一事务对象也是无效的

如果您需要并行地将数据写入数据库,您可能应该查看,这将允许您为每个单独的分区/进程在本地创建数据库连接和事务

如果要写入数据库的数据相对较小,可以将其收集(),这会将其作为驱动程序的本地对象返回,然后可以从那里写入数据库