小编Joe*_*ras的帖子

对象'DF __*'依赖于列'*' - 将int更改为double

基本上我在我的EF数据库中有一个表,它具有以下属性:

public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Image { get; set; }
public string WatchUrl { get; set; }
public int Year { get; set; }
public string Source { get; set; }
public int Duration { get; set; }
public int Rating { get; set; }
public virtual ICollection<Category> Categories { get; set; }
Run Code Online (Sandbox Code Playgroud)

它工作正常但是当我将Rating的int更改为double时,我在更新数据库时遇到以下错误:

对象'DF_ Movies _Rating__48CFD27E'取决于列'评级'.ALTER TABLE ALTER COLUMN评级失败,因为一个或多个对象访问此列.

有什么问题?

sql database sql-server entity-framework entity-framework-4

155
推荐指数
6
解决办法
13万
查看次数

不鼓励依赖循环引用,并且默认情况下在 Spring Boot 应用程序中禁止使用循环引用

当我运行 Spring Boot 应用程序时,出现以下错误消息。

\n
Description:\n\nThe dependencies of some of the beans in the application context form a cycle:\n\n\xe2\x94\x8c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x90\n|  securityConfiguration (field private com.prity.springbootdemo1.service.UserService com.prity.springbootdemo1.config.SecurityConfiguration.userService)\n\xe2\x86\x91     \xe2\x86\x93\n|  userServiceImpl (field private org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder com.prity.springbootdemo1.service.UserServiceImpl.passwordEncoder)\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x98\n\n\nAction:\n\nRelying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.\n
Run Code Online (Sandbox Code Playgroud)\n

spring-boot

17
推荐指数
2
解决办法
6万
查看次数

Hibernate SessionFactory vs Spring LocalSessionFactoryBean

我试图将spring3.2.x + hibernate4.x设置从xml移动到java配置.
下面是现有代码的片段:

import org.hibernate.SessionFactory;
import org.hibernate.Query;
import org.hibernate.Session;

public class StockDaoImpl implements StockDao{

    private SessionFactory sessionFactory;
    public SessionFactory getSessionFactory() {
        return sessionFactory;}
    public void setSessionFactory(SessionFactory sessionFactory) {
         this.sessionFactory = sessionFactory;
    }

    public void save(Stock stock){
        Session session = getSessionFactory().openSession();
        try{
        session.save(stock);
        }
        finally{
        session.close();
        }
    }
Run Code Online (Sandbox Code Playgroud)

spring配置文件

<!-- Stock Data Access Object -->
   <bean id="stockDao" class="com.data.dao.StockDaoImpl" >
        <property name="sessionFactory" ref="sessionFactory"></property>
   </bean> 

    <bean id="dataSource">
.....
</bean>

    <bean id="sessionFactory" 
         class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">

        <property name="dataSource">
          <ref bean="dataSource"/>
        </property>
        <property name="hibernateProperties">
           ......
         </property>
        <property …
Run Code Online (Sandbox Code Playgroud)

spring hibernate

9
推荐指数
1
解决办法
2万
查看次数

编译后的Eclipse maven无法在Eclipse中看到target/classes文件夹

在做之后mvn clean compile install我在eclipse中看不到target/classes文件夹中的任何文件.但是当我查看文件系统时,文件夹里面有编译的类文件.但是,当我开始单元测试时,它说"没有目标/类文件夹"

有任何想法吗 ???

java eclipse maven

8
推荐指数
2
解决办法
4万
查看次数

SQL Server 2008 中的 try_parse

在 SQL Server 2008 中获得相同输出的最简单方法是什么?

SQLServer 2012:

select
    try_parse(Isnull('123.66',0) as float) as a ,
    try_parse(Isnull('.',0) as float) as b 
Run Code Online (Sandbox Code Playgroud)

结果

a       b
------------
123.66  NULL
Run Code Online (Sandbox Code Playgroud)

SQLServer 2008:?

sql-server

6
推荐指数
2
解决办法
9141
查看次数

vbox,hbox内的Flex间距

hbox和vbox中的子节点之间有间距,

你怎么删除这个空的空间?

我需要在hbox或vbox的子元素之间留出0个空格

apache-flex layout containers

5
推荐指数
1
解决办法
8963
查看次数

Spring MVC形式:选择在POST操作中不返回对象

我有一个关于从用于填充选择表单的列表中检索对象的问题。

控制器:

@RequestMapping(value="listStaffMembers", method=RequestMethod.GET) 
public String listStaffMembers(Model model){        

    model.addAttribute("staffList", this.personManager.getAllStaff());      

    Person person = new Person();
    model.addAttribute("staffMember", person);

    model.addAttribute("staffListSize", this.personManager.getAllStaff().size());

    for (Person persons : this.personManager.getAllStaff())
        System.out.println("Query  Name:" + persons.getName() + "   Id:"+persons.getId());      

    return "staffList";
}
Run Code Online (Sandbox Code Playgroud)

未收到Person对象的控制器:

@RequestMapping(value="staffMemberCRUD", 
        method=RequestMethod.POST)
    //ModelAndView
public String staffMemberCRUD(@ModelAttribute("staffMember")Person person, Model model){    
    if(person!=null){

        model.addAttribute("staffMember", person);
        String name = person.getName();
        int id = person.getId();
        System.out.println("id:    "+ id);
        System.out.println("name:  "+ name);

    return "staffForm";
    }else{
        System.out.println("Person not saved, no entry, throwing null pointer exception");
        throw new NullPointerException();
    }
}
Run Code Online (Sandbox Code Playgroud)

人员类别:

@Entity(name="STAFF") …
Run Code Online (Sandbox Code Playgroud)

forms post spring jsp annotations

5
推荐指数
0
解决办法
4012
查看次数

用于提取具有字段的行的HQL函数仅包含数字

我有一个小问题要揭露:

我想从实体中提取,假设其名称为"CustomerDetail",其中特定字段(代码)只有数字字符的所有行.

在HQL中不存在ISNUMERIC()函数,如Sql Server,以及应用regex函数的可能性.

可能的解决方案如下:

SELECT C
FROM CustomerDetail C
WHERE C.code NOT LIKE '%A%'
AND C.code NOT LIKE '%B%'
Run Code Online (Sandbox Code Playgroud)

等重复这个条件整体alfabetical字母和特殊字符.

我认为这是一个糟糕的解决方案,性能低下(大量的LIKE)

拜托,您能告诉我一个更聪明的解决方案吗?

先感谢您

PS我的应用程序是多DBMS所以我不能使用SQL查询

regex hibernate hql isnumeric

5
推荐指数
1
解决办法
1483
查看次数

如何在 sequelize 的同一查询中使用 AND 和 OR 运算符?

我执行以下查询,但出现错误。我想要我最后发布的 SQL 查询的结果。

userServiceAppointmentModel.findAll({
        where: {
            technician_id: resultsFromAuthentication.technician_id,
            is_confirmed_by_user: 1,
            $or: {
                service_start_time: {
                    gte: curLocalDate
                },
                service_running_status: 1
            }
    },
        attributes: attributes
    }).complete(function (err, appointmentResponse) {
        if (err) {
            console.log(err);
        }


SELECT
    `id`, `technician_id`, `user_id`, `service_id`, `service_name`,
    `service_location_string`, `service_location_latitude`,
    `service_location_longitude`, `service_start_time`, `service_end_time`,
    `notes`, `total_cost`, `service_cost`, `is_confirmed_by_user`,
    `is_confirmed_by_technician`, `service_running_status`,
    `service_start_time_by_technician`,`service_complete_time_by_technician`
FROM `user_service_appointment` AS `user_service_appointment`
WHERE `user_service_appointment`.`technician_id`=154
AND `user_service_appointment`.`is_confirmed_by_user`=1
AND (`user_service_appointment`.`service_start_time` >='2015-02-26 01:07'
    OR `user_service_appointment`.`service_running_status`=1)
Run Code Online (Sandbox Code Playgroud)

mysql node.js sequelize.js

5
推荐指数
1
解决办法
3万
查看次数

Redshift 中的 Base64 解码

是否有 redshift/sql 函数来解码 base64 字符串?如果没有,请建议我如何在 redshift 中编写一个函数来解码 base64 ?

sql base64 decode amazon-redshift

5
推荐指数
1
解决办法
6004
查看次数