为什么我的桌子不可插入?

时间:2014-08-11 11:27:42

标签: sql oracle hibernate

好吧,我有两张桌子:SaveBatchSaveBatchLocal。他们有相同的领域。第一个表可以在Hibernate中插入,第二个表不是。这是我的代码:

    @Override
    @Transactional(readOnly = false)
    public void add(LinkedList<SmsEntity> smsEntityList) {
        try {           
            Session session = null;         
            session = this.sessionFactory.getCurrentSession();
            Iterator<SmsEntity> iterator = smsEntityList.iterator();
            while (iterator.hasNext()) {
                session.save(iterator.next());                  
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

我唯一改变的是实体类中的表名:

@Entity
@Table(name = "smsc.SaveBatch")
public class SmsEntity {

    @Id
    @Column(name = "id")
    private int id;

    @Column(name = "nextid")
    private Integer nextId;
    ...

如果@Table(name = "smsc.SaveBatch")

一切都很好,如果

@Table(name = "smsc.SaveBatchLocal")

没有新行。怎么了?另外,这是我的Oracle SQL Developer pic:

enter image description here

他们有不同的图标,意思不明。

1 个答案:

答案 0 :(得分:2)

SaveBatchLocal是一个global temporary表,这意味着其内容仅对插入它们的连接可见,并在该会话结束时自动删除。

请参阅http://www.oracle-base.com/articles/misc/temporary-tables.php

相关问题